[libcxx-commits] [libcxx] bf0d613 - [libcxx] Disable long double -> int128 test with msan

Vitaly Buka via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 25 10:42:20 PDT 2022


Author: Vitaly Buka
Date: 2022-04-25T10:42:10-07:00
New Revision: bf0d61369027e6808ea5641cba0b9bbeae1011ec

URL: https://github.com/llvm/llvm-project/commit/bf0d61369027e6808ea5641cba0b9bbeae1011ec
DIFF: https://github.com/llvm/llvm-project/commit/bf0d61369027e6808ea5641cba0b9bbeae1011ec.diff

LOG: [libcxx] Disable long double -> int128 test with msan

On x86 long double is 80 bit with padding, which produces
uninitialized bits in the result.
This will trigger errors with -fsanitize-memory-param-retval.

Can be triggered with D123979.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D123980

Added: 
    

Modified: 
    libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp b/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
index c212ad0b195d6..fe1e3063c5a99 100644
--- a/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
@@ -21,6 +21,8 @@
 #include <cstring>
 #include <limits>
 
+#include "test_macros.h"
+
 // std::bit_cast does not preserve padding bits, so if T has padding bits,
 // the results might not memcmp cleanly.
 template<bool HasUniqueObjectRepresentations = true, typename T>
@@ -230,7 +232,8 @@ bool tests() {
 #if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
         test_roundtrip_through<double, false>(i);
 #endif
-#if defined(__SIZEOF_INT128__) && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_INT128__
+#if defined(__SIZEOF_INT128__) && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_INT128__ &&                                       \
+    !TEST_HAS_FEATURE(memory_sanitizer) // Some bits are just padding.
         test_roundtrip_through<__int128_t, false>(i);
         test_roundtrip_through<__uint128_t, false>(i);
 #endif


        


More information about the libcxx-commits mailing list