Skip to content

Conversation

@thurstond
Copy link
Contributor

@thurstond thurstond commented Oct 24, 2025

#164906 converted a -Wpointer-bool-conversion warning into a -Wtautological-pointer-compare warning. Avoid both by using the bool cast.

llvm#164906 converted bool-pointer
compare into -Wtautological-pointer-compare.
@llvmbot
Copy link
Member

llvmbot commented Oct 24, 2025

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

Author: Thurston Dang (thurstond)

Changes

#164906 converted bool-pointer compare into -Wtautological-pointer-compare. Fix both by using the bool cast.


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

1 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_interceptors.cpp (+2-2)
diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp b/compiler-rt/lib/asan/asan_interceptors.cpp
index c43332cbc276d..8643271e89d70 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -58,7 +58,7 @@ namespace __asan {
 
 static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) {
 #if SANITIZER_INTERCEPT_STRNLEN
-  if (REAL(strnlen) != nullptr)
+  if (static_cast<bool>(REAL(strnlen)))
     return REAL(strnlen)(s, maxlen);
 #  endif
   return internal_strnlen(s, maxlen);
@@ -66,7 +66,7 @@ static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) {
 
 static inline uptr MaybeRealWcsnlen(const wchar_t* s, uptr maxlen) {
 #  if SANITIZER_INTERCEPT_WCSNLEN
-  if (REAL(wcsnlen) != nullptr)
+  if (static_cast<bool>(REAL(wcsnlen)))
     return REAL(wcsnlen)(s, maxlen);
 #  endif
   return internal_wcsnlen(s, maxlen);

@thurstond thurstond enabled auto-merge (squash) October 24, 2025 00:40
@thurstond thurstond merged commit 6a0f392 into llvm:main Oct 24, 2025
14 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 24, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux running on sanitizer-buildbot1 while building compiler-rt at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/21206

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/i386-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:237: warning: Compiler lib dir != compiler-rt lib dir
Compiler libdir:     "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/22/lib/i386-unknown-linux-gnu"
compiler-rt libdir:  "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/22/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10464 tests, 64 workers --
Testing:  0.. 10.. 20.. 30.. 
FAIL: ORC-x86_64-linux :: TestCases/Linux/x86-64/trivial-static-initializer.S (4244 of 10464)
******************** TEST 'ORC-x86_64-linux :: TestCases/Linux/x86-64/trivial-static-initializer.S' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
/home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang   -m64  -c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/orc/TestCases/Linux/x86-64/trivial-static-initializer.S # RUN: at line 7
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang -m64 -c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/orc/TestCases/Linux/x86-64/trivial-static-initializer.S
/home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink -orc-runtime=/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/x86_64-unknown-linux-gnu/liborc_rt.a /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp # RUN: at line 8
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink -orc-runtime=/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/x86_64-unknown-linux-gnu/liborc_rt.a /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
#0 0x000055bb9eb4b178 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink+0x2b50178)
#1 0x000055bb9eb48775 llvm::sys::RunSignalHandlers() (/home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink+0x2b4d775)
#2 0x000055bb9eb4bf41 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x0000734f63c458d0 (/lib/x86_64-linux-gnu/libc.so.6+0x458d0)
#4 0x000055bb9e948f3f llvm::orc::AsynchronousSymbolQuery::handleComplete(llvm::orc::ExecutionSession&)::RunQueryCompleteTask::run() Core.cpp:0:0
#5 0x000055bb9ea25c91 std::thread::_State_impl<std::thread::_Invoker<std::tuple<llvm::orc::DynamicThreadPoolTaskDispatcher::dispatch(std::unique_ptr<llvm::orc::Task, std::default_delete<llvm::orc::Task>>)::$_0>>>::_M_run() TaskDispatch.cpp:0:0
#6 0x0000734f640f2324 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xf2324)
#7 0x0000734f63ca27f1 (/lib/x86_64-linux-gnu/libc.so.6+0xa27f1)
#8 0x0000734f63d33b5c (/lib/x86_64-linux-gnu/libc.so.6+0x133b5c)
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.script: line 2: 1554119 Segmentation fault      (core dumped) /home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink -orc-runtime=/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/x86_64-unknown-linux-gnu/liborc_rt.a /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 

8 warning(s) in tests
Slowest Tests:
--------------------------------------------------------------------------
40.15s: libFuzzer-i386-libcxx-Linux :: fork_corpus_groups.test
39.93s: libFuzzer-i386-default-Linux :: fork_corpus_groups.test
39.73s: libFuzzer-i386-default-Linux :: fork.test
39.56s: libFuzzer-i386-static-libcxx-Linux :: fork_corpus_groups.test
39.41s: libFuzzer-x86_64-static-libcxx-Linux :: fork_corpus_groups.test
39.41s: libFuzzer-x86_64-libcxx-Linux :: fork_corpus_groups.test
39.40s: libFuzzer-i386-libcxx-Linux :: fork.test
39.18s: libFuzzer-i386-static-libcxx-Linux :: fork.test
38.68s: libFuzzer-x86_64-static-libcxx-Linux :: fork.test
Step 9 (test compiler-rt symbolizer) failure: test compiler-rt symbolizer (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/i386-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:237: warning: Compiler lib dir != compiler-rt lib dir
Compiler libdir:     "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/22/lib/i386-unknown-linux-gnu"
compiler-rt libdir:  "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/22/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:74: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10464 tests, 64 workers --
Testing:  0.. 10.. 20.. 30.. 
FAIL: ORC-x86_64-linux :: TestCases/Linux/x86-64/trivial-static-initializer.S (4244 of 10464)
******************** TEST 'ORC-x86_64-linux :: TestCases/Linux/x86-64/trivial-static-initializer.S' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
/home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang   -m64  -c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/orc/TestCases/Linux/x86-64/trivial-static-initializer.S # RUN: at line 7
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang -m64 -c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/orc/TestCases/Linux/x86-64/trivial-static-initializer.S
/home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink -orc-runtime=/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/x86_64-unknown-linux-gnu/liborc_rt.a /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp # RUN: at line 8
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink -orc-runtime=/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/x86_64-unknown-linux-gnu/liborc_rt.a /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
#0 0x000055bb9eb4b178 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink+0x2b50178)
#1 0x000055bb9eb48775 llvm::sys::RunSignalHandlers() (/home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink+0x2b4d775)
#2 0x000055bb9eb4bf41 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x0000734f63c458d0 (/lib/x86_64-linux-gnu/libc.so.6+0x458d0)
#4 0x000055bb9e948f3f llvm::orc::AsynchronousSymbolQuery::handleComplete(llvm::orc::ExecutionSession&)::RunQueryCompleteTask::run() Core.cpp:0:0
#5 0x000055bb9ea25c91 std::thread::_State_impl<std::thread::_Invoker<std::tuple<llvm::orc::DynamicThreadPoolTaskDispatcher::dispatch(std::unique_ptr<llvm::orc::Task, std::default_delete<llvm::orc::Task>>)::$_0>>>::_M_run() TaskDispatch.cpp:0:0
#6 0x0000734f640f2324 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xf2324)
#7 0x0000734f63ca27f1 (/lib/x86_64-linux-gnu/libc.so.6+0xa27f1)
#8 0x0000734f63d33b5c (/lib/x86_64-linux-gnu/libc.so.6+0x133b5c)
/home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.script: line 2: 1554119 Segmentation fault      (core dumped) /home/b/sanitizer-x86_64-linux/build/build_default/./bin/llvm-jitlink -orc-runtime=/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/22/lib/x86_64-unknown-linux-gnu/liborc_rt.a /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/orc/X86_64LinuxConfig/TestCases/Linux/x86-64/Output/trivial-static-initializer.S.tmp

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..

8 warning(s) in tests
Slowest Tests:
--------------------------------------------------------------------------
40.15s: libFuzzer-i386-libcxx-Linux :: fork_corpus_groups.test
39.93s: libFuzzer-i386-default-Linux :: fork_corpus_groups.test
39.73s: libFuzzer-i386-default-Linux :: fork.test
39.56s: libFuzzer-i386-static-libcxx-Linux :: fork_corpus_groups.test
39.41s: libFuzzer-x86_64-static-libcxx-Linux :: fork_corpus_groups.test
39.41s: libFuzzer-x86_64-libcxx-Linux :: fork_corpus_groups.test
39.40s: libFuzzer-i386-libcxx-Linux :: fork.test
39.18s: libFuzzer-i386-static-libcxx-Linux :: fork.test
38.68s: libFuzzer-x86_64-static-libcxx-Linux :: fork.test

dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
llvm#164906 converted a
-Wpointer-bool-conversion warning into a -Wtautological-pointer-compare
warning. Avoid both by using the bool cast.
Lukacma pushed a commit to Lukacma/llvm-project that referenced this pull request Oct 29, 2025
llvm#164906 converted a
-Wpointer-bool-conversion warning into a -Wtautological-pointer-compare
warning. Avoid both by using the bool cast.
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
llvm#164906 converted a
-Wpointer-bool-conversion warning into a -Wtautological-pointer-compare
warning. Avoid both by using the bool cast.
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.

4 participants