[libcxx-commits] [libcxx] Work around GCC test failure that is caused by enabling optimizations. (PR #73998)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 30 14:28:28 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Eric (EricWF)

<details>
<summary>Changes</summary>

While trying to work around MSAN/TSAN build timeouts, we enabled
optimizations on some tests. This caused GCC to start complaining that
some values may be uninitialized. I believe GCC is wrong, but more
investigation is needed.

The values are initialized when the variable `__g` is either < 0 or >=
0. Which only leaves out NaN I believe, which is likely well into UB
   land anyway.

However, more investigation needed.


---
Full diff: https://github.com/llvm/llvm-project/pull/73998.diff


1 Files Affected:

- (modified) libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp (+5-1) 


``````````diff
diff --git a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
index 9ab8b6f42749242..d0f6fbf0a1203ff 100644
--- a/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
+++ b/libcxx/test/std/numerics/rand/rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp
@@ -10,7 +10,11 @@
 
 // This test is super slow, in particular with msan or tsan. In order to avoid timeouts and to
 // spend less time waiting for this particular test to complete we compile with optimizations.
-// ADDITIONAL_COMPILE_FLAGS: -O1
+// ADDITIONAL_COMPILE_FLAGS(msan): -O1
+// ADDITIONAL_COMPILE_FLAGS(tsan): -O1
+
+// FIXME: This and other tests fail under GCC with optimizations enabled.
+// More investigation is needed, but it appears that  GCC is performing more constant folding.
 
 // <random>
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/73998


More information about the libcxx-commits mailing list