Skip to content

Conversation

pcc
Copy link
Contributor

@pcc pcc commented Aug 15, 2025

With gcc 15 we end up emitting a reference to the
std::__glibcxx_assert_fail function because of this change:
gcc-mirror/gcc@361d230
combined with assertion checks in the std::atomic implementation.

This reference is undefined with dfsan causing the test to fail. Fix it
by defining the macro that disables assertions.

Created using spr 1.3.6-beta.1
@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Peter Collingbourne (pcc)

Changes

With gcc 15 we end up emitting a reference to the
std::__glibcxx_assert_fail function because of this change:
gcc-mirror/gcc@361d230
combined with assertion checks in the std::atomic implementation.

This reference is undefined with dfsan causing the test to fail. Fix it
by defining the macro that disables assertions.


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

1 Files Affected:

  • (modified) compiler-rt/test/dfsan/atomic.cpp (+5-2)
diff --git a/compiler-rt/test/dfsan/atomic.cpp b/compiler-rt/test/dfsan/atomic.cpp
index 22ee323c752f8..73e1cbd17a7cd 100644
--- a/compiler-rt/test/dfsan/atomic.cpp
+++ b/compiler-rt/test/dfsan/atomic.cpp
@@ -1,9 +1,12 @@
-// RUN: %clangxx_dfsan %s -fno-exceptions -o %t && %run %t
-// RUN: %clangxx_dfsan -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -fno-exceptions -o %t && %run %t
+// RUN: %clangxx_dfsan %s -fno-exceptions -D_GLIBCXX_NO_ASSERTIONS -o %t && %run %t
+// RUN: %clangxx_dfsan -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 %s -fno-exceptions -D_GLIBCXX_NO_ASSERTIONS -o %t && %run %t
 //
 // Use -fno-exceptions to turn off exceptions to avoid instrumenting
 // __cxa_begin_catch, std::terminate and __gxx_personality_v0.
 //
+// Use -D_GLIBCXX_NO_ASSERTIONS to avoid depending on
+// std::__glibcxx_assert_fail with gcc >= 15.
+//
 // TODO: Support builtin atomics. For example, https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
 // DFSan instrumentation pass cannot identify builtin callsites yet.
 

pcc added 2 commits August 15, 2025 14:13
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
pcc added a commit that referenced this pull request Aug 15, 2025
With gcc 15 we end up emitting a reference to the
std::__glibcxx_assert_fail function because of this change:
gcc-mirror/gcc@361d230
combined with assertion checks in the std::atomic implementation.

This reference is undefined with dfsan causing the test to fail. Fix it
by defining the macro that disables assertions.

Pull Request: #153873
@pcc
Copy link
Contributor Author

pcc commented Aug 15, 2025

Landed manually

@pcc pcc closed this Aug 15, 2025
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Aug 15, 2025
With gcc 15 we end up emitting a reference to the
std::__glibcxx_assert_fail function because of this change:
gcc-mirror/gcc@361d230
combined with assertion checks in the std::atomic implementation.

This reference is undefined with dfsan causing the test to fail. Fix it
by defining the macro that disables assertions.

Pull Request: llvm/llvm-project#153873
mgorny pushed a commit to mgorny/llvm-project that referenced this pull request Sep 10, 2025
With gcc 15 we end up emitting a reference to the
std::__glibcxx_assert_fail function because of this change:
gcc-mirror/gcc@361d230
combined with assertion checks in the std::atomic implementation.

This reference is undefined with dfsan causing the test to fail. Fix it
by defining the macro that disables assertions.

Pull Request: llvm#153873
c-rhodes pushed a commit that referenced this pull request Oct 14, 2025
With gcc 15 we end up emitting a reference to the
std::__glibcxx_assert_fail function because of this change:
gcc-mirror/gcc@361d230
combined with assertion checks in the std::atomic implementation.

This reference is undefined with dfsan causing the test to fail. Fix it
by defining the macro that disables assertions.

Pull Request: #153873
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants