[clang] [llvm] [analyzer] Accept C library functions from the `std` namespace (PR #84469)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 12 10:14:33 PDT 2024


=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,Balazs Benics
 <benicsbalazs at gmail.com>,NagyDonat <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/84469 at github.com>


NagyDonat wrote:

@steakhal It seems that the unit tests that you suggested fail on many different buildbots:
- https://lab.llvm.org/buildbot/#/builders/86/builds/76040
- https://lab.llvm.org/buildbot/#/builders/265/builds/3177
- https://lab.llvm.org/buildbot/#/builders/231/builds/21515
- https://lab.llvm.org/buildbot/#/builders/123/builds/25486
- https://lab.llvm.org/buildbot/#/builders/60/builds/16359
- https://lab.llvm.org/buildbot/#/builders/236/builds/9980
- https://lab.llvm.org/buildbot/#/builders/93/builds/19173
- https://lab.llvm.org/buildbot/#/builders/5/builds/41701
- https://lab.llvm.org/buildbot/#/builders/168/builds/19170
- https://lab.llvm.org/buildbot/#/builders/72/builds/3087
- https://lab.llvm.org/buildbot/#/builders/74/builds/26589

Most of these reports are either crashes or memory sanitizer reports with messages like
> [----------] 1 test from IsCLibraryFunctionTest
[ RUN      ] IsCLibraryFunctionTest.AcceptsGlobal
==3810031==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5599a8127045 in getAttr<clang::ArmBuiltinAliasAttr> /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/include/clang/AST/DeclBase.h:579:12
    #1 0x5599a8127045 in clang::FunctionDecl::getBuiltinID(bool) const /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/AST/Decl.cpp:3597:26
    #2 0x5599a97495d6 in clang::ento::CheckerContext::isCLibraryFunction(clang::FunctionDecl const*, llvm::StringRef) /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp:54:22
    #3 0x5599a776b8a1 in IsCLibraryFunctionTest_AcceptsGlobal_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/unittests/StaticAnalyzer/IsCLibraryFunctionTest.cpp:40:3
    #4 0x5599a7ae1a3a in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc
    #5 0x5599a7ae1a3a in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/third-party/unittest/googletest/src/gtest.cc:2687:5
    [rest of stacktrace omitted]
SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-bootstrap-msan/build/llvm-project/clang/include/clang/AST/DeclBase.h:579:12 in getAttr<clang::ArmBuiltinAliasAttr>

but there are also some "managed to execute it, but the test failed" situations.

As similar issues did not appear when the method `isCLibraryFunction` was used in "real" invocations, I suspect that these issues might be caused by imperfections of the unit test environment (e.g. perhaps it doesn't initialize the builtin ID table, but the tests still happen to pass on linux).

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


More information about the cfe-commits mailing list