Skip to content

Conversation

woruyu
Copy link
Member

@woruyu woruyu commented Jul 10, 2025

Summary
This PR resolves #147187

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 10, 2025

@llvm/pr-subscribers-llvm-support
@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: woruyu (woruyu)

Changes

Summary
This PR resolves #147187


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

3 Files Affected:

  • (modified) clang/include/clang/Basic/SanitizerSpecialCaseList.h (+3-2)
  • (modified) clang/lib/Basic/NoSanitizeList.cpp (+2-1)
  • (modified) clang/lib/Basic/SanitizerSpecialCaseList.cpp (+7-2)
diff --git a/clang/include/clang/Basic/SanitizerSpecialCaseList.h b/clang/include/clang/Basic/SanitizerSpecialCaseList.h
index cf7485909e409..72cdcf7c467f0 100644
--- a/clang/include/clang/Basic/SanitizerSpecialCaseList.h
+++ b/clang/include/clang/Basic/SanitizerSpecialCaseList.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
 #define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
 
+#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/Sanitizers.h"
 #include "llvm/ADT/StringRef.h"
@@ -37,8 +38,8 @@ class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
          std::string &Error);
 
   static std::unique_ptr<SanitizerSpecialCaseList>
-  createOrDie(const std::vector<std::string> &Paths,
-              llvm::vfs::FileSystem &VFS);
+  createOrDie(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &VFS,
+              DiagnosticsEngine &Diags);
 
   // Query ignorelisted entries if any bit in Mask matches the entry's section.
   bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query,
diff --git a/clang/lib/Basic/NoSanitizeList.cpp b/clang/lib/Basic/NoSanitizeList.cpp
index 96f79fb2a2a29..1ae304fbd2132 100644
--- a/clang/lib/Basic/NoSanitizeList.cpp
+++ b/clang/lib/Basic/NoSanitizeList.cpp
@@ -22,7 +22,8 @@ using namespace clang;
 NoSanitizeList::NoSanitizeList(const std::vector<std::string> &NoSanitizePaths,
                                SourceManager &SM)
     : SSCL(SanitizerSpecialCaseList::createOrDie(
-          NoSanitizePaths, SM.getFileManager().getVirtualFileSystem())),
+          NoSanitizePaths, SM.getFileManager().getVirtualFileSystem(),
+          SM.getDiagnostics())),
       SM(SM) {}
 
 NoSanitizeList::~NoSanitizeList() = default;
diff --git a/clang/lib/Basic/SanitizerSpecialCaseList.cpp b/clang/lib/Basic/SanitizerSpecialCaseList.cpp
index f7bc1d5545d75..51a09b341f495 100644
--- a/clang/lib/Basic/SanitizerSpecialCaseList.cpp
+++ b/clang/lib/Basic/SanitizerSpecialCaseList.cpp
@@ -30,11 +30,16 @@ SanitizerSpecialCaseList::create(const std::vector<std::string> &Paths,
 
 std::unique_ptr<SanitizerSpecialCaseList>
 SanitizerSpecialCaseList::createOrDie(const std::vector<std::string> &Paths,
-                                      llvm::vfs::FileSystem &VFS) {
+                                      llvm::vfs::FileSystem &VFS,
+                                      DiagnosticsEngine &Diags) {
   std::string Error;
   if (auto SSCL = create(Paths, VFS, Error))
     return SSCL;
-  llvm::report_fatal_error(StringRef(Error));
+  unsigned DiagID = Diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
+                                          "failed to load NoSanitize file: %0");
+
+  Diags.Report(DiagID) << Error;
+  exit(1);
 }
 
 void SanitizerSpecialCaseList::createSanitizerSections() {

@woruyu
Copy link
Member Author

woruyu commented Jul 10, 2025

@hstk30-hw This patch is now ready for review.

@hstk30-hw
Copy link
Contributor

Need a test case at least.

@llvmbot llvmbot added the clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' label Jul 11, 2025
@woruyu
Copy link
Member Author

woruyu commented Jul 11, 2025

Need a test case at least.

Done!

@hstk30-hw
Copy link
Contributor

@shafik Take a look, pls.

@woruyu woruyu force-pushed the fix/report-error-sanitize-file branch 2 times, most recently from a4236f9 to 4920812 Compare July 11, 2025 06:20
@woruyu
Copy link
Member Author

woruyu commented Jul 16, 2025

Hi,@hstk30-hw, @shafik, @AaronBallman just wanted to check if there’s anything further needed from my side for this patch. I’d be happy to help clarify or adjust anything.

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, sorry for the delayed review! I had a comment several days ago but forgot to hit Submit. :-/

@woruyu woruyu requested review from MaskRay and AaronBallman July 21, 2025 08:03
SourceManager &SM) {
std::string Error;
if (!NoSanitizeL->init(LangOpts.NoSanitizeFiles, Error)) {
const std::string &Path = LangOpts.NoSanitizeFiles.front();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this assumes that the first file in the list is the one we cannot read; what happens if we can read that one fine but a subsequent file is where we struggle? We'd report the wrong path to the user in that case, which would be hard for them to reason about.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two kind of error for NoSanitizeL. The first is can't open file, the second is error parsing file, so I think using CustomDiagID is better!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I think using CustomDiagID is better!

Custom diagnostics are not an acceptable solution IMO; the reason is because they don't get a warning group associated with them and so users have no way to silence those diagnostics. We have some uses of the API in Clang but in every case they're the wrong tool to use.

We actually document this on the API itself, but not very clearly:

// TODO: Deprecate this once all uses are removed from Clang.
(I'll fix up the comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom diagnostics are not an acceptable solution IMO;

Thanks for the feedback! To confirm: is the correct fix to define dedicated diagnostics in a .td file like this:

def err_no_sanitize_file_open_fail : Error<
  "failed to load NoSanitize file: can't open file '%0'">;

def err_no_sanitize_file_parse_fail : Error<
  "failed to load NoSanitize file: error parsing file '%0'">;

def SanitizeIgnorelist : DiagGroup<"sanitize-ignorelist">;

Then use them accordingly in ASTContext::initSanitizers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost! You can split the diagnostics up if that's easier for you, but another approach would be:

def err_no_sanitize_file_failure : Error<
  "failed to %select{load|parse}0 sanitizer ignorelist file '%1'">;

where you only have a single diagnostic but pass in an argument to switch between load and parse.

Note, you don't need:

def SanitizeIgnorelist : DiagGroup<"sanitize-ignorelist">;

because diagnostic groups are only for warnings, and you're producing errors.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to go with:

def err_sanitize_ignorelist_failure : Error<
  "failed to sanitize ignorelist file: %0">;

instead of

def err_no_sanitize_file_failure : Error<
  "failed to %select{load|parse}0 sanitizer ignorelist file '%1'">;

for two reasons:
1.The %select logic is essentially string formatting and can be handled downstream where the error message is constructed.
2.Changing SpecialCaseList::createInternal to propagate structured error info adds unnecessary complexity, especially given its general-purpose nature.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.The %select logic is essentially string formatting and can be handled downstream where the error message is constructed.

Wellllll kind of yes but also kind of no. We try to avoid tying together strings like that because there are downstreams which want to localize diagnostic messages (and we'd like to someday do the same upstream). It's easier for localizers to handle %select for any various languages instead of having to try to reword diagnostics so that they still make sense with arbitrary string concatenation. So it works but we prefer %select whenever possible.

2.Changing SpecialCaseList::createInternal to propagate structured error info adds unnecessary complexity, especially given its general-purpose nature.

We currently have to thread through the error string, the suggestion is to use an enumeration as well as a string. e.g.,
"failed to %enum_select<SpecialCaseListFailure>{%Open{open}|%Parse{parse}}0 sanitizer ignorelist file: %1">; as the diagnostic message, and then use std::pair<unsigned, std::string> for passing the diagnostic information around, where the first parameter would be something like: diag::SpecialCaseListFailure::Open. So when you go to emit the diagnostic, it would effectively be: Diag(Loc, diag::err_no_sanitize_file_failure) << Error.first << Error.second;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! By the way, I find many diagnose to modify such as err_drv_malformed_sanitizer_coverage_allowlist, err_drv_malformed_sanitizer_ignorelist and so on, but I get a redefine error of SpecialCaseListFailure, so I change it to %select.

@woruyu
Copy link
Member Author

woruyu commented Jul 24, 2025

Additionally, I noticed the same issue occurs with -fprofile-list= (e.g. clang test.c -Xclang -fprofile-list=11111 -c). I plan to address it in a follow-up patch.

@woruyu woruyu force-pushed the fix/report-error-sanitize-file branch from 2184d03 to 49447c0 Compare July 25, 2025 03:23
@woruyu
Copy link
Member Author

woruyu commented Jul 25, 2025

we can't use diagnostics in llvm-tools, so keep the overload function std::string &Error, which is called by llvm-cfi-verify.cpp or CodeCoverage.cpp

LLVM_ABI static std::unique_ptr<SpecialCaseList>
  create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &FS,
         std::string &Error);

// first in llvm-cfi-verify.cpp
std::unique_ptr<SpecialCaseList> SpecialCaseList;
  if (IgnorelistFilename != "-") {
    std::string Error;
    SpecialCaseList = SpecialCaseList::create({IgnorelistFilename},
                                              *vfs::getRealFileSystem(), Error);
    if (!SpecialCaseList) {
      errs() << "Failed to get ignorelist: " << Error << "\n";
      exit(EXIT_FAILURE);
    }
  }

// second in CodeCoverage.cpp
// Read in -name-allowlist files.
if (!NameFilterFiles.empty()) {
  std::string SpecialCaseListErr;
  NameAllowlist = SpecialCaseList::create(
      NameFilterFiles, *vfs::getRealFileSystem(), SpecialCaseListErr);
  if (!NameAllowlist)
    error(SpecialCaseListErr);
}

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this LGTM! Do you need someone to merge on your behalf?

@woruyu
Copy link
Member Author

woruyu commented Jul 25, 2025

Thank you, this LGTM! Do you need someone to merge on your behalf?

Yes, please — I don’t have commit access.

@AaronBallman AaronBallman merged commit 9d3dd8e into llvm:main Jul 25, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 25, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux-bootstrap-hwasan running on sanitizer-buildbot11 while building clang,llvm at step 2 "annotate".

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

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-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{cxx} substitution: '/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{flags} substitution: '-pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{compile_flags} substitution: '-nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{link_flags} substitution: '-lc++experimental -nostdlib++ -L %{lib-dir} -Wl,-rpath,%{lib-dir} -lc++ -latomic'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{benchmark_flags} substitution: '-I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/benchmarks/google-benchmark/include -L /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/benchmarks/google-benchmark/lib -L /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/benchmarks/google-benchmark/lib64 -l benchmark'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{exec} substitution: '%{executor} --execdir %T -- '
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) All available features: add-latomic-workaround, buildhost=linux, c++26, c++experimental, can-create-symlinks, character-conversion-warnings, clang, clang-22, clang-22.0, clang-22.0.0, diagnose-if-support, enable-benchmarks=no, gcc-style-warnings, glibc-old-ru_RU-decimal-point, has-1024-bit-atomics, has-64-bit-atomics, has-fblocks, has-fconstexpr-steps, has-unix-headers, hwasan, large_tests, libcpp-abi-version=1, libcpp-hardening-mode=none, libcpp-has-no-availability-markup, libcpp-has-thread-api-pthread, linux, lsan, objective-c++, optimization=none, sanitizer-new-delete, std-at-least-c++03, std-at-least-c++11, std-at-least-c++14, std-at-least-c++17, std-at-least-c++20, std-at-least-c++23, std-at-least-c++26, stdlib=libc++, stdlib=llvm-libc++, target=aarch64-unknown-linux-gnu, verify-support
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 1500 seconds was requested on the command line. Forcing timeout to be 1500 seconds.
-- Testing: 10859 of 10878 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60
FAIL: llvm-libc++-shared.cfg.in :: std/modules/std.compat.pass.cpp (6984 of 10859)
******************** TEST 'llvm-libc++-shared.cfg.in :: std/modules/std.compat.pass.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# MODULE std
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -Wno-reserved-module-identifier -Wno-reserved-user-defined-literal --precompile -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -c /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/share/libc++/v1/std.cppm
# executed command: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -Wno-reserved-module-identifier -Wno-reserved-user-defined-literal --precompile -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -c /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/share/libc++/v1/std.cppm
# note: command had no output on stdout or stderr
# MODULE std.compat
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -Wno-reserved-module-identifier -Wno-reserved-user-defined-literal -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm --precompile -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -c /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/share/libc++/v1/std.compat.cppm
# executed command: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -Wno-reserved-module-identifier -Wno-reserved-user-defined-literal -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm --precompile -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -c /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/share/libc++/v1/std.compat.cppm
# note: command had no output on stdout or stderr
# COMPILED WITH
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/std/modules/std.compat.pass.cpp -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings  -fmodule-file=std.compat=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -lc++experimental -nostdlib++ -L /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/lib -Wl,-rpath,/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/lib -lc++ -latomic -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/t.tmp.exe
# executed command: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/std/modules/std.compat.pass.cpp -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -fmodule-file=std.compat=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -lc++experimental -nostdlib++ -L /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/lib -Wl,-rpath,/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/lib -lc++ -latomic -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/t.tmp.exe
# .---command stderr------------
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
# | Stack dump:
# | 0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22 -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -dumpdir /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/t.tmp.exe- -disable-free -clear-ast-before-backend -main-file-name std.compat.pcm -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -enable-tlsdesc -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -target-abi aapcs -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -fdebug-compilation-dir=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules -fcoverage-compilation-dir=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules -nostdinc++ -resource-dir /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/lib/clang/22 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -Wuser-defined-warnings -std=c++26 -fdeprecated-macro -ferror-limit 19 -pthread -fno-signed-char -fgnuc-version=4.2.1 -fno-implicit-modules -fmodule-file=std.compat=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fsanitize=hwaddress -fsanitize-system-ignorelist=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/lib/clang/22/share/hwasan_ignorelist.txt -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -default-function-attr hwasan-abi=interceptor -target-feature +tagged-globals -target-feature +outline-atomics -target-feature -fmv -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/lit-tmp-pvntw3iv/std-f2957e.o -x pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm
# | 1.	<eof> parser at end of file
# | 2.	Per-file LLVM IR generation
# |  #0 0x0000b6ef1daaa054 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x845a054)
# |  #1 0x0000b6ef1daa7b28 llvm::sys::RunSignalHandlers() (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8457b28)
# |  #2 0x0000b6ef1daaae64 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
# |  #3 0x0000efc946e7c8f8 (linux-vdso.so.1+0x8f8)
# |  #4 0x0000b6ef1e0896c0 clang::SanitizerSpecialCaseList::inSectionBlame(clang::SanitizerMask, llvm::StringRef, llvm::StringRef, llvm::StringRef) const (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8a396c0)
# |  #5 0x0000b6ef1e0884e8 clang::NoSanitizeList::containsFunction(clang::SanitizerMask, llvm::StringRef) const (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8a384e8)
# |  #6 0x0000b6ef1dcd51c8 clang::CodeGen::CodeGenModule::isInNoSanitizeList(clang::SanitizerMask, llvm::Function*, clang::SourceLocation) const (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x86851c8)
# |  #7 0x0000b6ef1e062de0 clang::CodeGen::CodeGenModule::CreateGlobalInitOrCleanUpFunction(llvm::FunctionType*, llvm::Twine const&, clang::CodeGen::CGFunctionInfo const&, clang::SourceLocation, bool, llvm::GlobalValue::LinkageTypes) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8a12de0)
# |  #8 0x0000b6ef1e06543c clang::CodeGen::CodeGenModule::EmitCXXModuleInitFunc(clang::Module*) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8a1543c)
# |  #9 0x0000b6ef1dcc2ff8 clang::CodeGen::CodeGenModule::Release() (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8672ff8)
# | #10 0x0000b6ef1e1e5f74 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
# | #11 0x0000b6ef1e1de8ac clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8b8e8ac)
# | #12 0x0000b6ef1fa60f68 clang::ParseAST(clang::Sema&, bool, bool) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0xa410f68)
# | #13 0x0000b6ef1e6d3f28 clang::FrontendAction::Execute() (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x9083f28)
# | #14 0x0000b6ef1e65a2ec clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x900a2ec)
# | #15 0x0000b6ef1e7c8760 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x9178760)
Step 10 (stage2/hwasan check-cxx) failure: stage2/hwasan check-cxx (failure)
...
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{cxx} substitution: '/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{flags} substitution: '-pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{compile_flags} substitution: '-nostdinc++ -I %{target-include-dir} -I %{include-dir} -I %{libcxx-dir}/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{link_flags} substitution: '-lc++experimental -nostdlib++ -L %{lib-dir} -Wl,-rpath,%{lib-dir} -lc++ -latomic'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{benchmark_flags} substitution: '-I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/benchmarks/google-benchmark/include -L /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/benchmarks/google-benchmark/lib -L /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/benchmarks/google-benchmark/lib64 -l benchmark'
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) Using %{exec} substitution: '%{executor} --execdir %T -- '
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/utils/libcxx/test/config.py:24: note: (llvm-libc++-shared.cfg.in) All available features: add-latomic-workaround, buildhost=linux, c++26, c++experimental, can-create-symlinks, character-conversion-warnings, clang, clang-22, clang-22.0, clang-22.0.0, diagnose-if-support, enable-benchmarks=no, gcc-style-warnings, glibc-old-ru_RU-decimal-point, has-1024-bit-atomics, has-64-bit-atomics, has-fblocks, has-fconstexpr-steps, has-unix-headers, hwasan, large_tests, libcpp-abi-version=1, libcpp-hardening-mode=none, libcpp-has-no-availability-markup, libcpp-has-thread-api-pthread, linux, lsan, objective-c++, optimization=none, sanitizer-new-delete, std-at-least-c++03, std-at-least-c++11, std-at-least-c++14, std-at-least-c++17, std-at-least-c++20, std-at-least-c++23, std-at-least-c++26, stdlib=libc++, stdlib=llvm-libc++, target=aarch64-unknown-linux-gnu, verify-support
llvm-lit: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 1500 seconds was requested on the command line. Forcing timeout to be 1500 seconds.
-- Testing: 10859 of 10878 tests, 72 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60
FAIL: llvm-libc++-shared.cfg.in :: std/modules/std.compat.pass.cpp (6984 of 10859)
******************** TEST 'llvm-libc++-shared.cfg.in :: std/modules/std.compat.pass.cpp' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# MODULE std
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -Wno-reserved-module-identifier -Wno-reserved-user-defined-literal --precompile -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -c /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/share/libc++/v1/std.cppm
# executed command: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -Wno-reserved-module-identifier -Wno-reserved-user-defined-literal --precompile -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -c /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/share/libc++/v1/std.cppm
# note: command had no output on stdout or stderr
# MODULE std.compat
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -Wno-reserved-module-identifier -Wno-reserved-user-defined-literal -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm --precompile -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -c /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/share/libc++/v1/std.compat.cppm
# executed command: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -Wno-reserved-module-identifier -Wno-reserved-user-defined-literal -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm --precompile -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -c /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/share/libc++/v1/std.compat.cppm
# note: command had no output on stdout or stderr
# COMPILED WITH
/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/std/modules/std.compat.pass.cpp -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings  -fmodule-file=std.compat=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -lc++experimental -nostdlib++ -L /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/lib -Wl,-rpath,/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/lib -lc++ -latomic -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/t.tmp.exe
# executed command: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang++ /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/std/modules/std.compat.pass.cpp -pthread --target=aarch64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=hwaddress -nostdinc++ -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/include/c++/v1 -I /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm-project/libcxx/test/support -std=c++26 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCPP_ENABLE_EXPERIMENTAL -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE -Wuser-defined-warnings -fmodule-file=std.compat=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -lc++experimental -nostdlib++ -L /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/lib -Wl,-rpath,/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test-suite-install/lib -lc++ -latomic -o /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/t.tmp.exe
# .---command stderr------------
# | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
# | Stack dump:
# | 0.	Program arguments: /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22 -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -dumpdir /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/t.tmp.exe- -disable-free -clear-ast-before-backend -main-file-name std.compat.pcm -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -enable-tlsdesc -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -target-abi aapcs -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -fdebug-compilation-dir=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules -fcoverage-compilation-dir=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules -nostdinc++ -resource-dir /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/lib/clang/22 -Werror -Wall -Wctad-maybe-unsupported -Wextra -Wshadow -Wundef -Wunused-template -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-noexcept-type -Wno-atomic-alignment -Wno-reserved-module-identifier -Wdeprecated-copy -Wdeprecated-copy-dtor -Wshift-negative-value -Wno-user-defined-literals -Wno-tautological-compare -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -Wno-local-type-template-args -Wno-c++11-extensions -Wno-unknown-pragmas -Wno-pass-failed -Wno-mismatched-new-delete -Wno-redundant-move -Wno-self-move -Wno-nullability-completeness -Wuser-defined-warnings -std=c++26 -fdeprecated-macro -ferror-limit 19 -pthread -fno-signed-char -fgnuc-version=4.2.1 -fno-implicit-modules -fmodule-file=std.compat=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm -fmodule-file=std=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.pcm -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fsanitize=hwaddress -fsanitize-system-ignorelist=/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/lib/clang/22/share/hwasan_ignorelist.txt -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -default-function-attr hwasan-abi=interceptor -target-feature +tagged-globals -target-feature +outline-atomics -target-feature -fmv -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/lit-tmp-pvntw3iv/std-f2957e.o -x pcm /home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/libcxx_build_hwasan/libcxx/test/std/modules/Output/std.compat.pass.cpp.dir/std.compat.pcm
# | 1.	<eof> parser at end of file
# | 2.	Per-file LLVM IR generation
# |  #0 0x0000b6ef1daaa054 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x845a054)
# |  #1 0x0000b6ef1daa7b28 llvm::sys::RunSignalHandlers() (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8457b28)
# |  #2 0x0000b6ef1daaae64 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
# |  #3 0x0000efc946e7c8f8 (linux-vdso.so.1+0x8f8)
# |  #4 0x0000b6ef1e0896c0 clang::SanitizerSpecialCaseList::inSectionBlame(clang::SanitizerMask, llvm::StringRef, llvm::StringRef, llvm::StringRef) const (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8a396c0)
# |  #5 0x0000b6ef1e0884e8 clang::NoSanitizeList::containsFunction(clang::SanitizerMask, llvm::StringRef) const (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8a384e8)
# |  #6 0x0000b6ef1dcd51c8 clang::CodeGen::CodeGenModule::isInNoSanitizeList(clang::SanitizerMask, llvm::Function*, clang::SourceLocation) const (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x86851c8)
# |  #7 0x0000b6ef1e062de0 clang::CodeGen::CodeGenModule::CreateGlobalInitOrCleanUpFunction(llvm::FunctionType*, llvm::Twine const&, clang::CodeGen::CGFunctionInfo const&, clang::SourceLocation, bool, llvm::GlobalValue::LinkageTypes) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8a12de0)
# |  #8 0x0000b6ef1e06543c clang::CodeGen::CodeGenModule::EmitCXXModuleInitFunc(clang::Module*) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8a1543c)
# |  #9 0x0000b6ef1dcc2ff8 clang::CodeGen::CodeGenModule::Release() (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8672ff8)
# | #10 0x0000b6ef1e1e5f74 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
# | #11 0x0000b6ef1e1de8ac clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x8b8e8ac)
# | #12 0x0000b6ef1fa60f68 clang::ParseAST(clang::Sema&, bool, bool) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0xa410f68)
# | #13 0x0000b6ef1e6d3f28 clang::FrontendAction::Execute() (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x9083f28)
# | #14 0x0000b6ef1e65a2ec clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x900a2ec)
# | #15 0x0000b6ef1e7c8760 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/b/sanitizer-aarch64-linux-bootstrap-hwasan/build/llvm_build0/bin/clang-22+0x9178760)

@AaronBallman
Copy link
Collaborator

Reverting the changes because these failures look related to the patch. I think we're missing a call to initSanitizers() somewhere, possibly in SanitizerSpecialCaseList::create(). I don't have the bandwidth to try to debug it now, hence the revert.

@woruyu
Copy link
Member Author

woruyu commented Jul 28, 2025

Reverting the changes because these failures look related to the patch. I think we're missing a call to initSanitizers() somewhere, possibly in SanitizerSpecialCaseList::create(). I don't have the bandwidth to try to debug it now, hence the revert.

I took a closer look at the build logs and I suspect the issue might be related to this code:

// in ASTUnit.cpp
  if (ToLoad >= LoadASTOnly)
    AST->Ctx = new ASTContext(*AST->LangOpts, AST->getSourceManager(),
                              PP.getIdentifierTable(), PP.getSelectorTable(),
                              PP.getBuiltinInfo(),
                              AST->getTranslationUnitKind());

The failing cases seem to be triggered during C++20 module builds, and from what I can tell, reproducing them locally is quite difficult. That said, this made me reconsider the core design of the merged patch.
Currently, the code assumes that ASTContext::initSanitizers() will always be called after constructing the context. However, this assumption introduces a latent risk—if the caller forgets to call initSanitizers(), we can end up with a std::unique_ptr being null at runtime. In my view, this is not a particularly robust design.
To make this more resilient, I believe it would be safer to revert to the previous approach, where construction and validation are combined via something like:

std::unique_ptr<SanitizerSpecialCaseList>
SanitizerSpecialCaseList::createOrDie(...) {
  ...
  if (auto SSCL = create(...))
    return SSCL;
  llvm::remove_fatal_error_handler();
  llvm::report_fatal_error(StringRef(Error), false);
}

This way, we can ensure that a valid object is always returned, and we can avoid unexpected crashes (or stack dumps) due to misuse. To me, this seems like a safer and more maintainable direction.

mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
report_fatal_error is not a good way to report diagnostics to the users, so this switches to using actual diagnostic reporting mechanisms instead.

Fixes llvm#147187
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Jul 28, 2025
ajaden-codes pushed a commit to Jaddyen/llvm-project that referenced this pull request Jul 28, 2025
report_fatal_error is not a good way to report diagnostics to the users, so this switches to using actual diagnostic reporting mechanisms instead.

Fixes llvm#147187
ajaden-codes pushed a commit to Jaddyen/llvm-project that referenced this pull request Jul 28, 2025
@AaronBallman
Copy link
Collaborator

Reverting the changes because these failures look related to the patch. I think we're missing a call to initSanitizers() somewhere, possibly in SanitizerSpecialCaseList::create(). I don't have the bandwidth to try to debug it now, hence the revert.

I took a closer look at the build logs and I suspect the issue might be related to this code:

// in ASTUnit.cpp
  if (ToLoad >= LoadASTOnly)
    AST->Ctx = new ASTContext(*AST->LangOpts, AST->getSourceManager(),
                              PP.getIdentifierTable(), PP.getSelectorTable(),
                              PP.getBuiltinInfo(),
                              AST->getTranslationUnitKind());

The failing cases seem to be triggered during C++20 module builds, and from what I can tell, reproducing them locally is quite difficult. That said, this made me reconsider the core design of the merged patch. Currently, the code assumes that ASTContext::initSanitizers() will always be called after constructing the context. However, this assumption introduces a latent risk—if the caller forgets to call initSanitizers(), we can end up with a std::unique_ptr being null at runtime. In my view, this is not a particularly robust design. To make this more resilient, I believe it would be safer to revert to the previous approach, where construction and validation are combined via something like:

std::unique_ptr<SanitizerSpecialCaseList>
SanitizerSpecialCaseList::createOrDie(...) {
  ...
  if (auto SSCL = create(...))
    return SSCL;
  llvm::remove_fatal_error_handler();
  llvm::report_fatal_error(StringRef(Error), false);
}

This way, we can ensure that a valid object is always returned, and we can avoid unexpected crashes (or stack dumps) due to misuse. To me, this seems like a safer and more maintainable direction.

I don't think reverting to the previous approach is the right choice, certainly not back to using report_fatal_error(). Combining construction and validation is a good goal, but can be tough because ASTContext is constructed very early and may not have the information needed to actually validate the sanitizer list at the point of construction. My intuition is that the two-step approach is going to be necessary at some level; but if there's a way we can have a "degenerate" special case list so that we don't have to ever create one in the first place would be nice -- most people don't pass a special case list on the command line anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category llvm:support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clang-21 Crash: fatal error: error in backend: can't open file './xxxxxx': No such file or directory
6 participants