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

via flang-commits flang-commits at lists.llvm.org
Sat Dec 2 16:21:02 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 1/3] 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>
 

>From d3a46c128fd597ca193c7f698f5fab3eb5784e66 Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Sat, 2 Dec 2023 17:19:02 -0500
Subject: [PATCH 2/3] Re-add other slow test

---
 .../deque/deque.modifiers/insert_iter_iter.pass.cpp          | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
index 946c2cfabf02b..b99c2b87cc5fe 100644
--- a/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/sequences/deque/deque.modifiers/insert_iter_iter.pass.cpp
@@ -9,6 +9,11 @@
 // REQUIRES: long_tests
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
 
+// 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(msan): -O1
+// ADDITIONAL_COMPILE_FLAGS(tsan): -O1
+
 // <deque>
 
 // template <class InputIterator>

>From e50eb9e9a283d5f0b3cb73cd26507637ff0f1f40 Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Sat, 2 Dec 2023 19:20:46 -0500
Subject: [PATCH 3/3] satisfy clang format

---
 .../rand.dist/rand.dist.bern/rand.dist.bern.negbin/eval.pass.cpp | 1 -
 1 file changed, 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 bc586d3d68626..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
@@ -8,7 +8,6 @@
 //
 // REQUIRES: long_tests
 
-
 // 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(msan): -O1



More information about the flang-commits mailing list