[clang] [lld] [lldb] [llvm] [libc] [libcxx] [flang] [compiler-rt] Work around GCC test failure that is caused by enabling optimizations. (PR #73998)

via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 2 14:16:13 PST 2023


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

>From 2e7676bac9fb0c8694dd1ee635508ae4d4a6421d Mon Sep 17 00:00:00 2001
From: Eric Fiselier <eric at efcs.ca>
Date: Thu, 30 Nov 2023 17:23:37 -0500
Subject: [PATCH] Work around GCC test failure that is caused by enabling
 optimizations.

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.
---
 .../rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 9ab8b6f427492..d0f6fbf0a1203 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>
 



More information about the cfe-commits mailing list