Skip to content

[Clang] Crash when building trivial C++ code on PowerPC (32-bit) #111993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
awilfox opened this issue Oct 11, 2024 · 5 comments · Fixed by #112927
Closed

[Clang] Crash when building trivial C++ code on PowerPC (32-bit) #111993

awilfox opened this issue Oct 11, 2024 · 5 comments · Fixed by #112927
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] release:backport

Comments

@awilfox
Copy link

awilfox commented Oct 11, 2024

While building Clang 17, 18, and 19 natively on 32-bit PowerPC, I encountered over 500 test failures:

Testing Time: 295.42s
  Skipped          :    33
  Unsupported      :   232
  Passed           : 33093
  Expectedly Failed:    26
  Failed           :   532

All of them look similar to:

********************
FAIL: Clang :: Profile/cxx-rangefor.cpp (14370 of 19007)
******************** TEST 'Clang :: Profile/cxx-rangefor.cpp' FAILED ********************
Script:
--
: 'RUN: at line 3';   /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/lib/clang/17/include -nostdsysteminc -x c++ /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp -triple powerpc-foxkit-linux-musl -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument=clang > /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpgen
: 'RUN: at line 4';   /usr/lib/llvm17/bin/FileCheck --input-file=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpgen -check-prefix=CHECK -check-prefix=PGOGEN /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp
: 'RUN: at line 6';   /usr/lib/llvm17/bin/llvm-profdata merge /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/Inputs/cxx-rangefor.proftext -o /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmp.profdata
: 'RUN: at line 7';   /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/lib/clang/17/include -nostdsysteminc -x c++ /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp -triple powerpc-foxkit-linux-musl -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-use-path=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmp.profdata > /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpuse
: 'RUN: at line 8';   /usr/lib/llvm17/bin/FileCheck --input-file=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpuse -check-prefix=CHECK -check-prefix=PGOUSE /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp
--
Exit Code: 139

Command Output (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/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/lib/clang/17/include -nostdsysteminc -x c++ /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp -triple powerpc-foxkit-linux-musl -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-use-path=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmp.profdata
1.	/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp:41:1: current parser token 'int'
2.	/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp:14:6: LLVM IR generation of declaration 'range_for'
3.	/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp:14:6: Generating code for declaration 'range_for'
 #0 0xffffffffeaa391dc (/usr/lib/llvm17/lib/libLLVM-17.so+0x9e21dc)
 #1 0x001023c4  0x3c4 clang::StmtIteratorBase::HandleDecl(clang::Decl*)
 #2 0x001023c4 /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/AST/StmtIterator.cpp:81:5 
 #3 0x001023c4 clang::StmtIteratorBase::inStmt() const /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtIterator.h:57:13
 #4 0x001023c4 clang::StmtIteratorImpl<clang::ConstStmtIterator, clang::Stmt const*>::operator++() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtIterator.h:94:15
 #5 0x001023c4 (anonymous namespace)::ComputeRegionCounts::VisitStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:404:42
 #6 0xfffffffff423bd4c clang::CXXForRangeStmt::getBeginStmt() const /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtCXX.h:176:53
 #7 0xfffffffff423bd4c VisitCXXForRangeStmt /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:575:26
 #8 0xfffffffff423bd4c clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::ComputeRegionCounts, void>::Visit(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/include/clang/AST/StmtNodes.inc:55:1
 #9 0xfffffffff579632c clang::StmtIteratorBase::inStmt() const /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtIterator.h:57:13
#10 0xfffffffff579632c clang::StmtIteratorImpl<clang::ConstStmtIterator, clang::Stmt const*>::operator++() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtIterator.h:94:15
#11 0xfffffffff579632c (anonymous namespace)::ComputeRegionCounts::VisitStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:404:42
#12 0xfffffffff578e4ec VisitFunctionDecl /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:414:3
#13 0xfffffffff578e4ec clang::CodeGen::CodeGenPGO::computeRegionCounts(clang::Decl const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:934:29
#14 0xfffffffff579632c clang::CodeGen::CodeGenPGO::applyFunctionAttributes(llvm::IndexedInstrProfReader*, llvm::Function*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:946:3
#15 0xfffffffff579632c clang::CodeGen::CodeGenPGO::assignRegionCounters(clang::GlobalDecl, llvm::Function*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:838:28
#16 0xfffffffff57aed4c clang::Decl::getKind() const /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/DeclBase.h:435:51
#17 0xfffffffff57aed4c clang::CXXDestructorDecl::classof(clang::Decl const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/DeclCXX.h:2804:58
#18 0xfffffffff57aed4c llvm::isa_impl<clang::CXXDestructorDecl, clang::FunctionDecl, void>::doit(clang::FunctionDecl const&) /usr/lib/llvm17/include/llvm/Support/Casting.h:64:64
#19 0xfffffffff57aed4c llvm::isa_impl_cl<clang::CXXDestructorDecl, clang::FunctionDecl const*>::doit(clang::FunctionDecl const*) /usr/lib/llvm17/include/llvm/Support/Casting.h:110:36
#20 0xfffffffff57aed4c llvm::isa_impl_wrap<clang::CXXDestructorDecl, clang::FunctionDecl const*, clang::FunctionDecl const*>::doit(clang::FunctionDecl const* const&) /usr/lib/llvm17/include/llvm/Support/Casting.h:137:41
#21 0xfffffffff57aed4c llvm::isa_impl_wrap<clang::CXXDestructorDecl, clang::FunctionDecl const* const, clang::FunctionDecl const*>::doit(clang::FunctionDecl const* const&) /usr/lib/llvm17/include/llvm/Support/Casting.h:129:13
#22 0xfffffffff57aed4c llvm::CastIsPossible<clang::CXXDestructorDecl, clang::FunctionDecl const*, void>::isPossible(clang::FunctionDecl const* const&) /usr/lib/llvm17/include/llvm/Support/Casting.h:257:62
#23 0xfffffffff57aed4c llvm::CastInfo<clang::CXXDestructorDecl, clang::FunctionDecl const* const, void>::isPossible(clang::FunctionDecl const* const&) /usr/lib/llvm17/include/llvm/Support/Casting.h:509:38
#24 0xfffffffff57aed4c bool llvm::isa<clang::CXXDestructorDecl, clang::FunctionDecl const*>(clang::FunctionDecl const* const&) /usr/lib/llvm17/include/llvm/Support/Casting.h:549:46
#25 0xfffffffff57aed4c clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenFunction.cpp:1450:29
#26 0xfffffffff57af198 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenModule.cpp:5662:3
#27 0xfffffffff571e378 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenModule.cpp:3907:47
#28 0xfffffffff5771d38 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenModule.cpp:3648:27
#29 0xfffffffff576bdf8 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenModule.cpp:6561:37
#30 0xfffffffff576c81c (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/ModuleBuilder.cpp:189:67
#31 0xfffffffff5776658 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenAction.cpp:237:7
#32 0xfffffffff5819294 clang::ParseAST(clang::Sema&, bool, bool) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/Parse/ParseAST.cpp:167:17
#33 0xfffffffff5701640 clang::ASTFrontendAction::ExecuteAction() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/Frontend/FrontendAction.cpp:1173:11
#34 0xfffffffff3b0c4d0 clang::CodeGenAction::ExecuteAction() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenAction.cpp:1208:5
#35 0xfffffffff626a8d0 clang::FrontendAction::Execute() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/Frontend/FrontendAction.cpp:1059:21
#36 0xfffffffff5700404 llvm::Error::getPtr() const /usr/lib/llvm17/include/llvm/Support/Error.h:273:12
#37 0xfffffffff5700404 llvm::Error::operator bool() /usr/lib/llvm17/include/llvm/Support/Error.h:233:22
#38 0xfffffffff5700404 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/Frontend/CompilerInstance.cpp:1053:42
#39 0xfffffffff6270a8c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:273:32
#40 0xfffffffff62025c0 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/tools/driver/cc1_main.cpp:249:40
#41 0xfffffffff6305fe8 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/tools/driver/driver.cpp:366:20
#42 0x00980520 clang_main(int, char**, llvm::ToolContext const&) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/tools/driver/driver.cpp:407:44
#43 0x0097b13c main /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/tools/driver/clang-driver.cpp:16:1
#44 0x0097e810 libc_start_main_stage2 /usr/src/packages/system/musl/src/musl-1.2.3/src/env/__libc_start_main.c:95:2
#45 0x009794ec __libc_start_main /usr/src/packages/system/musl/src/musl-1.2.3/src/env/__libc_start_main.c:87:1
#46 0xfffffffff7c74aa8 _start_c /usr/src/packages/system/musl/src/musl-1.2.3/crt/crt1.c:19:1
#47 0xfffffffff7c74b18 _start_c /usr/src/packages/system/musl/src/musl-1.2.3/crt/crt1.c:15:1
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM-17.so        0xeaa391dc
1                       0x001023c4 __kernel_sigtramp32 + 0
2  libclang-cpp.so.17   0xf423bd4c clang::StmtIteratorBase::HandleDecl(clang::Decl*) + 148
3  libclang-cpp.so.17   0xf579632c
4  libclang-cpp.so.17   0xf578e4ec
5  libclang-cpp.so.17   0xf579632c
6  libclang-cpp.so.17   0xf57aed4c clang::CodeGen::CodeGenPGO::computeRegionCounts(clang::Decl const*) + 408
7  libclang-cpp.so.17   0xf57af198 clang::CodeGen::CodeGenPGO::assignRegionCounters(clang::GlobalDecl, llvm::Function*) + 436
8  libclang-cpp.so.17   0xf571e378 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 720
9  libclang-cpp.so.17   0xf5771d38 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 536
10 libclang-cpp.so.17   0xf576bdf8 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 804
11 libclang-cpp.so.17   0xf576c81c clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 2436
12 libclang-cpp.so.17   0xf5776658
13 libclang-cpp.so.17   0xf5819294
14 libclang-cpp.so.17   0xf5701640
15 libclang-cpp.so.17   0xf3b0c4d0 clang::ParseAST(clang::Sema&, bool, bool) + 648
16 libclang-cpp.so.17   0xf626a8d0 clang::ASTFrontendAction::ExecuteAction() + 136
17 libclang-cpp.so.17   0xf5700404 clang::CodeGenAction::ExecuteAction() + 560
18 libclang-cpp.so.17   0xf6270a8c clang::FrontendAction::Execute() + 300
19 libclang-cpp.so.17   0xf62025c0 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 972
20 libclang-cpp.so.17   0xf6305fe8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 708
21 clang                0x00980520 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1688
22 clang                0x0097b13c
23 clang                0x0097e810 clang_main(int, char**, llvm::ToolContext const&) + 6068
24 clang                0x009794ec main + 80
25 ld-musl-powerpc.so.1 0xf7c74aa8
26 ld-musl-powerpc.so.1 0xf7c74b18 __libc_start_main + 108
27 clang                0x00979594 _start_c + 68
28 clang                0x00979550 _start_c + 0
/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.script: line 5: 40612 Segmentation fault      /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/lib/clang/17/include -nostdsysteminc -x c++ /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp -triple powerpc-foxkit-linux-musl -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-use-path=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmp.profdata > /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpuse

--

I enabled ASan and UBSan - which was extremely difficult to fit in the 4 GB binary size limit on a 32-bit platform, but I managed it - and found no real useful information other than the address was oddly set to 0xffffffff:

ASan output

********************
FAIL: Clang :: Modules/merge-vtable-codegen.cpp (12288 of 19831)
******************** TEST 'Clang :: Modules/merge-vtable-codegen.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: rm -rf /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp
+ rm -rf /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp
RUN: at line 4: /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp/b.pcm      -emit-module /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap      -I /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen
+ /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp/b.pcm -emit-module /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap -I /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen
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/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp/b.pcm -emit-module /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap -I /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen
1.	<eof> parser at end of file
2.	/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen/b.h:10:6: serializing 'b'
 #0 0xffffffffe72168e0 llvm::sys::RunSignalHandlers() (/usr/lib/llvm18/lib/libLLVM.so.18.1+0x9ef8e0)
 #1 0xffffffffe7216d74 (/usr/lib/llvm18/lib/libLLVM.so.18.1+0x9efd74)
 #2 0x001023c4 (+0x3c4)
 #3 0xffffffffee186004 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::StmtProfiler, void>::Visit(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/StmtVisitor.h:43:9
 #4 0xffffffffee18ea54 (anonymous namespace)::StmtProfiler::VisitStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:243:42
 #5 0xffffffffee18dfe8 clang::DeclGroupRef::getKind() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/DeclGroup.h:59:48
 #6 0xffffffffee18dfe8 clang::DeclGroupRef::isSingleDecl() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/DeclGroup.h:80:45
 #7 0xffffffffee18dfe8 clang::DeclGroupRef::begin() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/DeclGroup.h:113:21
 #8 0xffffffffee18dfe8 clang::DeclStmt::decl_begin() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Stmt.h:1551:59
 #9 0xffffffffee18dfe8 clang::DeclStmt::decls() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Stmt.h:1546:53
#10 0xffffffffee18dfe8 VisitDeclStmt /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:253:32
#11 0xffffffffee18dfe8 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::StmtProfiler, void>::Visit(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/include/clang/AST/StmtNodes.inc:1474:1
#12 0xffffffffee18ea54 (anonymous namespace)::StmtProfiler::VisitStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:243:42
#13 0xffffffffee18e260 VisitVAArgExpr /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:1531:1
#14 0xffffffffee18e260 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::StmtProfiler, void>::Visit(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/include/clang/AST/StmtNodes.inc:1498:1
#15 0xffffffffee1943f0 ~StmtProfiler /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:39:29
#16 0xffffffffee1943f0 ~StmtProfilerWithoutPointers /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:184:9
#17 0xffffffffee1943f0 clang::Stmt::ProcessODRHash(llvm::FoldingSetNodeID&, clang::ODRHash&) const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:2446:1
#18 0xffffffffedf9c21c clang::ODRHash::AddStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/ODRHash.cpp:27:1
#19 0xffffffffedfa90b8 clang::ODRHash::AddFunctionDecl(clang::FunctionDecl const*, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/ODRHash.cpp:727:39
#20 0xffffffffed76ad04 clang::FunctionDecl::setHasODRHash(bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Decl.h:2097:67
#21 0xffffffffed76ad04 clang::FunctionDecl::getODRHash() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/Decl.cpp:4480:16
#22 0xfffffffff301a3d8 clang::ASTDeclWriter::VisitFunctionDecl(clang::FunctionDecl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:712:21
#23 0xfffffffff3027e40 decltype(auto) llvm::dyn_cast<clang::DeclaratorDecl, clang::Decl>(clang::Decl*) /usr/lib/llvm18/include/llvm/Support/Casting.h:662:3
#24 0xfffffffff3027e40 clang::ASTDeclWriter::Visit(clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:279:42
#25 0xfffffffff3028b78 clang::ASTDeclWriter::Emit(clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:50:12
#26 0xfffffffff3028b78 clang::ASTWriter::WriteDecl(clang::ASTContext&, clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:2738:27
#27 0xfffffffff2fc2948 clang::ASTWriter::WriteASTCore(clang::Sema&, llvm::StringRef, clang::Module*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriter.cpp:5095:18
#28 0xfffffffff2fc5a74 clang::ASTWriter::WriteAST(clang::Sema&, llvm::StringRef, clang::Module*, llvm::StringRef, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriter.cpp:4646:11
#29 0xfffffffff30673d4 std::__shared_ptr<clang::PCHBuffer, (__gnu_cxx::_Lock_policy)2>::get() const /usr/include/c++/13.3.0/bits/shared_ptr_base.h:1666:16
#30 0xfffffffff30673d4 std::__shared_ptr_access<clang::PCHBuffer, (__gnu_cxx::_Lock_policy)2, false, false>::_M_get() const /usr/include/c++/13.3.0/bits/shared_ptr_base.h:1363:69
#31 0xfffffffff30673d4 std::__shared_ptr_access<clang::PCHBuffer, (__gnu_cxx::_Lock_policy)2, false, false>::operator->() const /usr/include/c++/13.3.0/bits/shared_ptr_base.h:1357:15
#32 0xfffffffff30673d4 clang::PCHGenerator::HandleTranslationUnit(clang::ASTContext&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/GeneratePCH.cpp:68:9
#33 0xfffffffff34f8b88 __gnu_cxx::__normal_iterator<std::unique_ptr<clang::ASTConsumer, std::default_delete<clang::ASTConsumer>>*, std::vector<std::unique_ptr<clang::ASTConsumer, std::default_delete<clang::ASTConsumer>>, std::allocator<std::unique_ptr<clang::ASTConsumer, std::default_delete<clang::ASTConsumer>>>>>::operator++() /usr/include/c++/13.3.0/bits/stl_iterator.h:1111:4
#34 0xfffffffff34f8b88 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/MultiplexConsumer.cpp:297:25
#35 0xffffffffece55344 void clang::finalize<std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>>(std::vector<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>, std::allocator<std::unique_ptr<clang::TemplateInstantiationCallback, std::default_delete<clang::TemplateInstantiationCallback>>>>&, clang::Sema const&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/Sema/TemplateInstCallback.h:54:3
#36 0xffffffffece55344 clang::ParseAST(clang::Sema&, bool, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Parse/ParseAST.cpp:183:11
#37 0xfffffffff344ac14 clang::ASTFrontendAction::ExecuteAction() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/FrontendAction.cpp:1185:1
#38 0xfffffffff345339c clang::FrontendAction::Execute() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/FrontendAction.cpp:1069:21
#39 0xfffffffff327df18 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/CompilerInstance.cpp:1057:42
#40 0xfffffffff35d2eb4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:38
#41 0x007b14c4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/cc1_main.cpp:294:40
#42 0x00797918 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/driver.cpp:369:35
#43 0x0079bc28 clang_main(int, char**, llvm::ToolContext const&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/driver.cpp:405:26
#44 0x00796678 main /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/tools/driver/clang-driver.cpp:17:20
#45 0xfffffffff7c1caa8 libc_start_main_stage2 /usr/src/packages/system/musl/src/musl-1.2.3/src/env/__libc_start_main.c:95:2
#46 0xfffffffff7c1cb18 __libc_start_main /usr/src/packages/system/musl/src/musl-1.2.3/src/env/__libc_start_main.c:87:1
#47 0x007967b0 _start_c /usr/src/packages/system/musl/src/musl-1.2.3/crt/crt1.c:19:1
#48 0x0079676c _start_c /usr/src/packages/system/musl/src/musl-1.2.3/crt/crt1.c:15:1
AddressSanitizer:DEADLYSIGNAL
=================================================================
==5553==ERROR: AddressSanitizer: SEGV on unknown address 0xffffffff (pc 0xee186130 bp 0xe33539a0 sp 0xffa80930 T0)
==5553==The signal is caused by a UNKNOWN memory access.
    #0 0xee186130 in llvm::isa_impl<clang::BinaryOperator, clang::Stmt, void>::doit(clang::Stmt const&) /usr/lib/llvm18/include/llvm/Support/Casting.h:64
    #1 0xee186130 in llvm::isa_impl_cl<clang::BinaryOperator, clang::Stmt const*>::doit(clang::Stmt const*) /usr/lib/llvm18/include/llvm/Support/Casting.h:110
    #2 0xee186130 in llvm::isa_impl_wrap<clang::BinaryOperator, clang::Stmt const*, clang::Stmt const*>::doit(clang::Stmt const* const&) /usr/lib/llvm18/include/llvm/Support/Casting.h:137
    #3 0xee186130 in llvm::isa_impl_wrap<clang::BinaryOperator, clang::Stmt const* const, clang::Stmt const*>::doit(clang::Stmt const* const&) /usr/lib/llvm18/include/llvm/Support/Casting.h:129
    #4 0xee186130 in llvm::CastIsPossible<clang::BinaryOperator, clang::Stmt const*, void>::isPossible(clang::Stmt const* const&) /usr/lib/llvm18/include/llvm/Support/Casting.h:257
    #5 0xee186130 in llvm::CastInfo<clang::BinaryOperator, clang::Stmt const*, void>::doCastIfPossible(clang::Stmt const* const&) /usr/lib/llvm18/include/llvm/Support/Casting.h:493
    #6 0xee186130 in decltype(auto) llvm::dyn_cast<clang::BinaryOperator, clang::Stmt const>(clang::Stmt const*) /usr/lib/llvm18/include/llvm/Support/Casting.h:663
    #7 0xee186130 in Visit /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/StmtVisitor.h:47
    #8 0xee18ea50 in VisitStmt /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:245
    #9 0xee18dfe4 in VisitDeclStmt /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:252
    #10 0xee18dfe4 in Visit /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/include/clang/AST/StmtNodes.inc:1474
    #11 0xee18ea50 in VisitStmt /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:245
    #12 0xee18e25c in VisitExpr /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:1306
    #13 0xee18e25c in VisitVAArgExpr /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:1530
    #14 0xee18e25c in Visit /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/include/clang/AST/StmtNodes.inc:1498
    #15 0xee1943ec in clang::Stmt::ProcessODRHash(llvm::FoldingSetNodeID&, clang::ODRHash&) const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:2445
    #16 0xedf9c218 in clang::ODRHash::AddStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/ODRHash.cpp:26
    #17 0xedfa90b4 in clang::ODRHash::AddFunctionDecl(clang::FunctionDecl const*, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/ODRHash.cpp:723
    #18 0xed76ad00 in clang::FunctionDecl::getODRHash() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/Decl.cpp:4479
    #19 0xf301a3d4 in clang::ASTDeclWriter::VisitFunctionDecl(clang::FunctionDecl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:712
    #20 0xf3027e3c in clang::ASTDeclWriter::Visit(clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:274
    #21 0xf3028b74 in clang::ASTWriter::WriteDecl(clang::ASTContext&, clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:2735
    #22 0xf2fc2944 in clang::ASTWriter::WriteASTCore(clang::Sema&, llvm::StringRef, clang::Module*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriter.cpp:5095
    #23 0xf2fc5a70 in clang::ASTWriter::WriteAST(clang::Sema&, llvm::StringRef, clang::Module*, llvm::StringRef, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriter.cpp:4645
    #24 0xf30673d0 in clang::PCHGenerator::HandleTranslationUnit(clang::ASTContext&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/GeneratePCH.cpp:68
    #25 0xf34f8b84 in clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/MultiplexConsumer.cpp:298
    #26 0xece55340 in clang::ParseAST(clang::Sema&, bool, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Parse/ParseAST.cpp:176
    #27 0xf344ac10 in clang::ASTFrontendAction::ExecuteAction() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/FrontendAction.cpp:1183
    #28 0xf3453398 in clang::FrontendAction::Execute() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/FrontendAction.cpp:1069
    #29 0xf327df14 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/CompilerInstance.cpp:1057
    #30 0xf35d2eb0 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272
    #31 0x7b14c0 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/cc1_main.cpp:294
    #32 0x797914 in ExecuteCC1Tool /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/driver.cpp:365
    #33 0x79bc24 in clang_main(int, char**, llvm::ToolContext const&) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/driver.cpp:405
    #34 0x796674 in main /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/tools/driver/clang-driver.cpp:17
    #35 0xf7c1caa4 in libc_start_main_stage2 src/env/__libc_start_main.c:95

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/lib/llvm18/include/llvm/Support/Casting.h:64 in llvm::isa_impl<clang::BinaryOperator, clang::Stmt, void>::doit(clang::Stmt const&)
==5553==ABORTING

--

UBSan output

********************
FAIL: Clang :: Analysis/malloc.c (954 of 19831)
******************** TEST 'Clang :: Analysis/malloc.c' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
RUN: at line 1: /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -Wno-strict-prototypes -Wno-error=implicit-int -verify /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Analysis/malloc.c    -analyzer-checker=core    -analyzer-checker=alpha.deadcode.UnreachableCode    -analyzer-checker=alpha.core.CastSize    -analyzer-checker=unix    -analyzer-checker=debug.ExprInspection
+ /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -Wno-strict-prototypes -Wno-error=implicit-int -verify /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Analysis/malloc.c -analyzer-checker=core -analyzer-checker=alpha.deadcode.UnreachableCode -analyzer-checker=alpha.core.CastSize -analyzer-checker=unix -analyzer-checker=debug.ExprInspection
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd158d928 which does not point to an object of type 'TranslationUnitDecl'
0xd158d928: note: object is of type 'clang::Decl'
 00 00 00 00  ef 84 de b8 00 00 00 00  00 00 00 00 00 00 00 00  00 06 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~
              vptr for 'clang::Decl'
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd158dd50 which does not point to an object of type 'TagDecl'
0xd158dd50: note: object is of type 'clang::TypeDecl'
 00 00 00 00  ef 84 dc a8 00 00 00 00  d1 58 d9 40 00 00 00 00  6e 06 00 18 00 00 00 00  d1 54 55 f8
              ^~~~~~~~~~~
              vptr for 'clang::TypeDecl'
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd158df40 which does not point to an object of type 'TypedefNameDecl'
0xd158df40: note: object is of type 'clang::TypeDecl'
 00 00 00 00  ef 84 dc a8 00 00 00 00  d1 58 d9 40 00 00 00 00  7a 06 00 90 00 00 00 00  d1 54 55 c8
              ^~~~~~~~~~~
              vptr for 'clang::TypeDecl'
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd158e670 which does not point to an object of type 'VarDecl'
0xd158e670: note: object is of type 'clang::DeclaratorDecl'
 00 00 fe 74  ef 84 d8 68 00 00 00 00  d1 58 d9 40 00 00 fe 7a  4a 06 00 80 00 00 00 00  d1 52 5d c8
              ^~~~~~~~~~~
              vptr for 'clang::DeclaratorDecl'
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd1511670 which does not point to an object of type 'FunctionDecl'
0xd1511670: note: object is of type 'clang::DeclaratorDecl'
 00 a2 02 66  ef 84 d8 68 00 00 00 00  d1 58 d9 40 00 00 ff 46  3e 06 00 80 00 00 00 00  d1 55 c8 38
              ^~~~~~~~~~~
              vptr for 'clang::DeclaratorDecl'
/usr/lib/llvm18/include/llvm/Support/Casting.h:110:36: runtime error: reference binding to misaligned address 0xffffffff for type 'const struct Stmt', which requires 4 byte alignment
0xffffffff: note: pointer points here
<memory cannot be printed>
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Expr.h:3980:27: runtime error: member call on misaligned address 0xffffffff for type 'const struct Stmt', which requires 4 byte alignment
0xffffffff: note: pointer points here
<memory cannot be printed>
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Stmt.h:1357:44: runtime error: member access within misaligned address 0xffffffff for type 'const struct Stmt', which requires 4 byte alignment
0xffffffff: note: pointer points here
<memory cannot be printed>
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/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -Wno-strict-prototypes -Wno-error=implicit-int -verify /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Analysis/malloc.c -analyzer-checker=core -analyzer-checker=alpha.deadcode.UnreachableCode -analyzer-checker=alpha.core.CastSize -analyzer-checker=unix -analyzer-checker=debug.ExprInspection
1.	<eof> parser at end of file
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM.so.18.1      0xd4dcb8e0 llvm::sys::RunSignalHandlers() + 124
1  libLLVM.so.18.1      0xd4dcbd74
2                       0x001023c4 __kernel_sigtramp32 + 0
3  libclang-cpp.so.18.1 0xe305db7c
4  libclang-cpp.so.18.1 0xe3fd2c3c
5  libclang-cpp.so.18.1 0xed3a75f8
6  libclang-cpp.so.18.1 0xed3b2b88
7  libclang-cpp.so.18.1 0xed3b2b88
8  libclang-cpp.so.18.1 0xed3b2a04
9  libclang-cpp.so.18.1 0xecf5dad8
10 libclang-cpp.so.18.1 0xecf4bdd8 clang::ento::CheckerManager::runCheckersOnASTBody(clang::Decl const*, clang::ento::AnalysisManager&, clang::ento::BugReporter&) + 728
11 libclang-cpp.so.18.1 0xee2bf654
12 libclang-cpp.so.18.1 0xee2c2b90
13 libclang-cpp.so.18.1 0xee2c74f4
14 libclang-cpp.so.18.1 0xee325370
15 libclang-cpp.so.18.1 0xe2f50e30 clang::ParseAST(clang::Sema&, bool, bool) + 3260
16 libclang-cpp.so.18.1 0xec1770d0 clang::ASTFrontendAction::ExecuteAction() + 4884
17 libclang-cpp.so.18.1 0xec17e988 clang::FrontendAction::Execute() + 3448
18 libclang-cpp.so.18.1 0xebfcad9c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 6048
19 libclang-cpp.so.18.1 0xec3b68a8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4248
20 clang                0x00ae9cfc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 13956
21 clang                0x00acc34c
22 clang                0x00acef54 clang_main(int, char**, llvm::ToolContext const&) + 1184
23 clang                0x00acaf14 main + 148
24 ld-musl-powerpc.so.1 0xf79d3aa8
25 ld-musl-powerpc.so.1 0xf79d3b18 __libc_start_main + 108
26 clang                0x00acafb8 _start_c + 68
27 clang                0x00acaf74 _start_c + 0
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Analysis/Output/malloc.c.script: line 1:  9067 Segmentation fault      /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -Wno-strict-prototypes -Wno-error=implicit-int -verify /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Analysis/malloc.c -analyzer-checker=core -analyzer-checker=alpha.deadcode.UnreachableCode -analyzer-checker=alpha.core.CastSize -analyzer-checker=unix -analyzer-checker=debug.ExprInspection

--

Clang 16 works fine, so I bisected through:

Bisection log

# bad: [e19b7dc36bc047b9eb72078d034596be766da350] Bump version to 17.0.1
# good: [603c286334b07f568d39f6706c848f576914f323] Bump the trunk major version to 17
git bisect start 'llvmorg-17.0.1' 'llvmorg-17-init'
# bad: [3db96aa89e5103730d929dd2ba668af26753e2a4] [LangRef] Fix broken tail call optimization link
git bisect bad 3db96aa89e5103730d929dd2ba668af26753e2a4
# good: [c09730c23e207accbf487a5142647c118630a5d2] [RISCV] Pre-commit tests for D145897. NFC
git bisect good c09730c23e207accbf487a5142647c118630a5d2
# bad: [b04bc87c9edca0e93330948b88292ebcde891ce2] [lldb][NFC] Delete unused function Breakpoint::GetEventIdentifier
git bisect bad b04bc87c9edca0e93330948b88292ebcde891ce2
# skip: [74c0bd240499683078d4f15d31de690950da8231] [RISCV] Remove UpperBound from SchedMxList and create WorstCaseBehavior records
git bisect skip 74c0bd240499683078d4f15d31de690950da8231
# good: [8d93cbed6e383d5a8b5985f9087cb31ffd5ac7f5] [InstCombine] Precommit tests
git bisect good 8d93cbed6e383d5a8b5985f9087cb31ffd5ac7f5
# good: [a3252d1a2c568792974a4bc7413b0c61a43053e9] [lldb][NFC] Move various constructor definitions from .h to .cpp
git bisect good a3252d1a2c568792974a4bc7413b0c61a43053e9
# bad: [c75d36e8271558492d78d22e5659fbb542ca103e] [Hexagon] Convert some tests to opaque pointers (NFC)
git bisect bad c75d36e8271558492d78d22e5659fbb542ca103e
# bad: [9fecbd4ae69e0d41dd94250b0224ce0814f92d9d] [X86] vector-compare-any_of.ll - add AVX1OR2 check-prefix and make AVX a common check-prefix
git bisect bad 9fecbd4ae69e0d41dd94250b0224ce0814f92d9d
# bad: [6261adfa51f2d93c8258e7b2d9811d607f3e50a5] [InstCombine] Fold more intrinsics over selects
git bisect bad 6261adfa51f2d93c8258e7b2d9811d607f3e50a5
# bad: [46cfdfb5f799d01ffe902dc8f2b66b3d9c7eec4f] [mlir][Linalg] Fix Generalize transform
git bisect bad 46cfdfb5f799d01ffe902dc8f2b66b3d9c7eec4f
# bad: [00701d32b7a495a69a420e0d9958ab15091da028] [RISCV] Remove -mattr=+f from rvk-user-csr-name.s.
git bisect bad 00701d32b7a495a69a420e0d9958ab15091da028
# bad: [7df3c71b508b65284483225685f1ba19777f2bbb] [clang] Fix 2 bugs with parenthesized aggregate initialization
git bisect bad 7df3c71b508b65284483225685f1ba19777f2bbb
# good: [72c662a47f101712c203de782da34029d29e081f] [mlir][vector][NFC] Clean up vector gather lowering comments
git bisect good 72c662a47f101712c203de782da34029d29e081f
# bad: [b24e2900fa743e0abab7f4fa9747e5cbbfc2567a] [lldb] Fix macos build after e64cc756819d (2/2)
git bisect bad b24e2900fa743e0abab7f4fa9747e5cbbfc2567a
# bad: [2ea8a3a56a513484ee36c8ad12f93f35665321d1] [lld][WebAssembly] Process stub libraries before performing LTO
git bisect bad 2ea8a3a56a513484ee36c8ad12f93f35665321d1
# bad: [bc73ef0031b50f7443615fef614fb4ecaaa4bd11] PR60985: Fix merging of lambda closure types across modules.
git bisect bad bc73ef0031b50f7443615fef614fb4ecaaa4bd11
# first bad commit: [bc73ef0031b50f7443615fef614fb4ecaaa4bd11] PR60985: Fix merging of lambda closure types across modules.

and found that #60985 was the culprit. Looking at the code, I immediately saw the issue. The Ptr value in LazyOffsetPtr is 64-bits (uint64_t), and the new method getAddressOfPointer returns a reference to Ptr as a pointer-to-pointer. The problem is that on 32-bit big endian platforms (such as PPC), pointing to Ptr will read the top 32 bits of the value, not the bottom 32 bits.

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Oct 11, 2024
awilfox added a commit to awilfox/llvm-project that referenced this issue Oct 11, 2024
On big-endian systems, narrow casting will read the higher bits of the
value.  LazyOffsetPtr's `getAddressOfPointer` returns the address-of
`Ptr` which was unconditionally a 64-bit value.  On 32-bit big endian
systems, reading this value as a 32-bit pointer returns invalid data.

Fixes: bc73ef0 ("PR60985: Fix merging of lambda closure types across modules.")
Closes: llvm#111993
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels Oct 11, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 11, 2024

@llvm/issue-subscribers-clang-frontend

Author: A. Wilcox (awilfox)

While building Clang 17, 18, and 19 natively on 32-bit PowerPC, I encountered over 500 test failures:
Testing Time: 295.42s
  Skipped          :    33
  Unsupported      :   232
  Passed           : 33093
  Expectedly Failed:    26
  Failed           :   532

All of them look similar to:

********************
FAIL: Clang :: Profile/cxx-rangefor.cpp (14370 of 19007)
******************** TEST 'Clang :: Profile/cxx-rangefor.cpp' FAILED ********************
Script:
--
: 'RUN: at line 3';   /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/lib/clang/17/include -nostdsysteminc -x c++ /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp -triple powerpc-foxkit-linux-musl -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument=clang &gt; /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpgen
: 'RUN: at line 4';   /usr/lib/llvm17/bin/FileCheck --input-file=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpgen -check-prefix=CHECK -check-prefix=PGOGEN /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp
: 'RUN: at line 6';   /usr/lib/llvm17/bin/llvm-profdata merge /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/Inputs/cxx-rangefor.proftext -o /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmp.profdata
: 'RUN: at line 7';   /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/lib/clang/17/include -nostdsysteminc -x c++ /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp -triple powerpc-foxkit-linux-musl -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-use-path=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmp.profdata &gt; /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpuse
: 'RUN: at line 8';   /usr/lib/llvm17/bin/FileCheck --input-file=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpuse -check-prefix=CHECK -check-prefix=PGOUSE /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp
--
Exit Code: 139

Command Output (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/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/lib/clang/17/include -nostdsysteminc -x c++ /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp -triple powerpc-foxkit-linux-musl -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-use-path=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmp.profdata
1.	/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp:41:1: current parser token 'int'
2.	/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp:14:6: LLVM IR generation of declaration 'range_for'
3.	/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp:14:6: Generating code for declaration 'range_for'
 #<!-- -->0 0xffffffffeaa391dc (/usr/lib/llvm17/lib/libLLVM-17.so+0x9e21dc)
 #<!-- -->1 0x001023c4  0x3c4 clang::StmtIteratorBase::HandleDecl(clang::Decl*)
 #<!-- -->2 0x001023c4 /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/AST/StmtIterator.cpp:81:5 
 #<!-- -->3 0x001023c4 clang::StmtIteratorBase::inStmt() const /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtIterator.h:57:13
 #<!-- -->4 0x001023c4 clang::StmtIteratorImpl&lt;clang::ConstStmtIterator, clang::Stmt const*&gt;::operator++() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtIterator.h:94:15
 #<!-- -->5 0x001023c4 (anonymous namespace)::ComputeRegionCounts::VisitStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:404:42
 #<!-- -->6 0xfffffffff423bd4c clang::CXXForRangeStmt::getBeginStmt() const /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtCXX.h:176:53
 #<!-- -->7 0xfffffffff423bd4c VisitCXXForRangeStmt /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:575:26
 #<!-- -->8 0xfffffffff423bd4c clang::StmtVisitorBase&lt;llvm::make_const_ptr, (anonymous namespace)::ComputeRegionCounts, void&gt;::Visit(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/include/clang/AST/StmtNodes.inc:55:1
 #<!-- -->9 0xfffffffff579632c clang::StmtIteratorBase::inStmt() const /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtIterator.h:57:13
#<!-- -->10 0xfffffffff579632c clang::StmtIteratorImpl&lt;clang::ConstStmtIterator, clang::Stmt const*&gt;::operator++() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/StmtIterator.h:94:15
#<!-- -->11 0xfffffffff579632c (anonymous namespace)::ComputeRegionCounts::VisitStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:404:42
#<!-- -->12 0xfffffffff578e4ec VisitFunctionDecl /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:414:3
#<!-- -->13 0xfffffffff578e4ec clang::CodeGen::CodeGenPGO::computeRegionCounts(clang::Decl const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:934:29
#<!-- -->14 0xfffffffff579632c clang::CodeGen::CodeGenPGO::applyFunctionAttributes(llvm::IndexedInstrProfReader*, llvm::Function*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:946:3
#<!-- -->15 0xfffffffff579632c clang::CodeGen::CodeGenPGO::assignRegionCounters(clang::GlobalDecl, llvm::Function*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenPGO.cpp:838:28
#<!-- -->16 0xfffffffff57aed4c clang::Decl::getKind() const /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/DeclBase.h:435:51
#<!-- -->17 0xfffffffff57aed4c clang::CXXDestructorDecl::classof(clang::Decl const*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/include/clang/AST/DeclCXX.h:2804:58
#<!-- -->18 0xfffffffff57aed4c llvm::isa_impl&lt;clang::CXXDestructorDecl, clang::FunctionDecl, void&gt;::doit(clang::FunctionDecl const&amp;) /usr/lib/llvm17/include/llvm/Support/Casting.h:64:64
#<!-- -->19 0xfffffffff57aed4c llvm::isa_impl_cl&lt;clang::CXXDestructorDecl, clang::FunctionDecl const*&gt;::doit(clang::FunctionDecl const*) /usr/lib/llvm17/include/llvm/Support/Casting.h:110:36
#<!-- -->20 0xfffffffff57aed4c llvm::isa_impl_wrap&lt;clang::CXXDestructorDecl, clang::FunctionDecl const*, clang::FunctionDecl const*&gt;::doit(clang::FunctionDecl const* const&amp;) /usr/lib/llvm17/include/llvm/Support/Casting.h:137:41
#<!-- -->21 0xfffffffff57aed4c llvm::isa_impl_wrap&lt;clang::CXXDestructorDecl, clang::FunctionDecl const* const, clang::FunctionDecl const*&gt;::doit(clang::FunctionDecl const* const&amp;) /usr/lib/llvm17/include/llvm/Support/Casting.h:129:13
#<!-- -->22 0xfffffffff57aed4c llvm::CastIsPossible&lt;clang::CXXDestructorDecl, clang::FunctionDecl const*, void&gt;::isPossible(clang::FunctionDecl const* const&amp;) /usr/lib/llvm17/include/llvm/Support/Casting.h:257:62
#<!-- -->23 0xfffffffff57aed4c llvm::CastInfo&lt;clang::CXXDestructorDecl, clang::FunctionDecl const* const, void&gt;::isPossible(clang::FunctionDecl const* const&amp;) /usr/lib/llvm17/include/llvm/Support/Casting.h:509:38
#<!-- -->24 0xfffffffff57aed4c bool llvm::isa&lt;clang::CXXDestructorDecl, clang::FunctionDecl const*&gt;(clang::FunctionDecl const* const&amp;) /usr/lib/llvm17/include/llvm/Support/Casting.h:549:46
#<!-- -->25 0xfffffffff57aed4c clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&amp;) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenFunction.cpp:1450:29
#<!-- -->26 0xfffffffff57af198 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenModule.cpp:5662:3
#<!-- -->27 0xfffffffff571e378 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenModule.cpp:3907:47
#<!-- -->28 0xfffffffff5771d38 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenModule.cpp:3648:27
#<!-- -->29 0xfffffffff576bdf8 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenModule.cpp:6561:37
#<!-- -->30 0xfffffffff576c81c (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/ModuleBuilder.cpp:189:67
#<!-- -->31 0xfffffffff5776658 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenAction.cpp:237:7
#<!-- -->32 0xfffffffff5819294 clang::ParseAST(clang::Sema&amp;, bool, bool) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/Parse/ParseAST.cpp:167:17
#<!-- -->33 0xfffffffff5701640 clang::ASTFrontendAction::ExecuteAction() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/Frontend/FrontendAction.cpp:1173:11
#<!-- -->34 0xfffffffff3b0c4d0 clang::CodeGenAction::ExecuteAction() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/CodeGen/CodeGenAction.cpp:1208:5
#<!-- -->35 0xfffffffff626a8d0 clang::FrontendAction::Execute() /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/Frontend/FrontendAction.cpp:1059:21
#<!-- -->36 0xfffffffff5700404 llvm::Error::getPtr() const /usr/lib/llvm17/include/llvm/Support/Error.h:273:12
#<!-- -->37 0xfffffffff5700404 llvm::Error::operator bool() /usr/lib/llvm17/include/llvm/Support/Error.h:233:22
#<!-- -->38 0xfffffffff5700404 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/Frontend/CompilerInstance.cpp:1053:42
#<!-- -->39 0xfffffffff6270a8c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:273:32
#<!-- -->40 0xfffffffff62025c0 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/tools/driver/cc1_main.cpp:249:40
#<!-- -->41 0xfffffffff6305fe8 ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/tools/driver/driver.cpp:366:20
#<!-- -->42 0x00980520 clang_main(int, char**, llvm::ToolContext const&amp;) /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/tools/driver/driver.cpp:407:44
#<!-- -->43 0x0097b13c main /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/tools/driver/clang-driver.cpp:16:1
#<!-- -->44 0x0097e810 libc_start_main_stage2 /usr/src/packages/system/musl/src/musl-1.2.3/src/env/__libc_start_main.c:95:2
#<!-- -->45 0x009794ec __libc_start_main /usr/src/packages/system/musl/src/musl-1.2.3/src/env/__libc_start_main.c:87:1
#<!-- -->46 0xfffffffff7c74aa8 _start_c /usr/src/packages/system/musl/src/musl-1.2.3/crt/crt1.c:19:1
#<!-- -->47 0xfffffffff7c74b18 _start_c /usr/src/packages/system/musl/src/musl-1.2.3/crt/crt1.c:15:1
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM-17.so        0xeaa391dc
1                       0x001023c4 __kernel_sigtramp32 + 0
2  libclang-cpp.so.17   0xf423bd4c clang::StmtIteratorBase::HandleDecl(clang::Decl*) + 148
3  libclang-cpp.so.17   0xf579632c
4  libclang-cpp.so.17   0xf578e4ec
5  libclang-cpp.so.17   0xf579632c
6  libclang-cpp.so.17   0xf57aed4c clang::CodeGen::CodeGenPGO::computeRegionCounts(clang::Decl const*) + 408
7  libclang-cpp.so.17   0xf57af198 clang::CodeGen::CodeGenPGO::assignRegionCounters(clang::GlobalDecl, llvm::Function*) + 436
8  libclang-cpp.so.17   0xf571e378 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&amp;) + 720
9  libclang-cpp.so.17   0xf5771d38 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 536
10 libclang-cpp.so.17   0xf576bdf8 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) + 804
11 libclang-cpp.so.17   0xf576c81c clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 2436
12 libclang-cpp.so.17   0xf5776658
13 libclang-cpp.so.17   0xf5819294
14 libclang-cpp.so.17   0xf5701640
15 libclang-cpp.so.17   0xf3b0c4d0 clang::ParseAST(clang::Sema&amp;, bool, bool) + 648
16 libclang-cpp.so.17   0xf626a8d0 clang::ASTFrontendAction::ExecuteAction() + 136
17 libclang-cpp.so.17   0xf5700404 clang::CodeGenAction::ExecuteAction() + 560
18 libclang-cpp.so.17   0xf6270a8c clang::FrontendAction::Execute() + 300
19 libclang-cpp.so.17   0xf62025c0 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) + 972
20 libclang-cpp.so.17   0xf6305fe8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 708
21 clang                0x00980520 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) + 1688
22 clang                0x0097b13c
23 clang                0x0097e810 clang_main(int, char**, llvm::ToolContext const&amp;) + 6068
24 clang                0x009794ec main + 80
25 ld-musl-powerpc.so.1 0xf7c74aa8
26 ld-musl-powerpc.so.1 0xf7c74b18 __libc_start_main + 108
27 clang                0x00979594 _start_c + 68
28 clang                0x00979550 _start_c + 0
/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.script: line 5: 40612 Segmentation fault      /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/lib/clang/17/include -nostdsysteminc -x c++ /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/test/Profile/cxx-rangefor.cpp -triple powerpc-foxkit-linux-musl -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-use-path=/home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmp.profdata &gt; /home/awilcox/Code/awilfox/rust-next/bootstrap/clang17/src/llvm-project-17.0.1.src/clang/build/test/Profile/Output/cxx-rangefor.cpp.tmpuse

--

I enabled ASan and UBSan - which was extremely difficult to fit in the 4 GB binary size limit on a 32-bit platform, but I managed it - and found no real useful information other than the address was oddly set to 0xffffffff:

<details><summary>ASan output</summary>
<p>

********************
FAIL: Clang :: Modules/merge-vtable-codegen.cpp (12288 of 19831)
******************** TEST 'Clang :: Modules/merge-vtable-codegen.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: rm -rf /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp
+ rm -rf /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp
RUN: at line 4: /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp/b.pcm      -emit-module /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap      -I /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen
+ /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp/b.pcm -emit-module /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap -I /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen
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/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodule-name=b -o /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Modules/Output/merge-vtable-codegen.cpp.tmp/b.pcm -emit-module /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen/merge-vtable-codegen.modulemap -I /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen
1.	&lt;eof&gt; parser at end of file
2.	/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Modules/Inputs/merge-vtable-codegen/b.h:10:6: serializing 'b'
 #<!-- -->0 0xffffffffe72168e0 llvm::sys::RunSignalHandlers() (/usr/lib/llvm18/lib/libLLVM.so.18.1+0x9ef8e0)
 #<!-- -->1 0xffffffffe7216d74 (/usr/lib/llvm18/lib/libLLVM.so.18.1+0x9efd74)
 #<!-- -->2 0x001023c4 (+0x3c4)
 #<!-- -->3 0xffffffffee186004 clang::StmtVisitorBase&lt;llvm::make_const_ptr, (anonymous namespace)::StmtProfiler, void&gt;::Visit(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/StmtVisitor.h:43:9
 #<!-- -->4 0xffffffffee18ea54 (anonymous namespace)::StmtProfiler::VisitStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:243:42
 #<!-- -->5 0xffffffffee18dfe8 clang::DeclGroupRef::getKind() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/DeclGroup.h:59:48
 #<!-- -->6 0xffffffffee18dfe8 clang::DeclGroupRef::isSingleDecl() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/DeclGroup.h:80:45
 #<!-- -->7 0xffffffffee18dfe8 clang::DeclGroupRef::begin() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/DeclGroup.h:113:21
 #<!-- -->8 0xffffffffee18dfe8 clang::DeclStmt::decl_begin() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Stmt.h:1551:59
 #<!-- -->9 0xffffffffee18dfe8 clang::DeclStmt::decls() const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Stmt.h:1546:53
#<!-- -->10 0xffffffffee18dfe8 VisitDeclStmt /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:253:32
#<!-- -->11 0xffffffffee18dfe8 clang::StmtVisitorBase&lt;llvm::make_const_ptr, (anonymous namespace)::StmtProfiler, void&gt;::Visit(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/include/clang/AST/StmtNodes.inc:1474:1
#<!-- -->12 0xffffffffee18ea54 (anonymous namespace)::StmtProfiler::VisitStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:243:42
#<!-- -->13 0xffffffffee18e260 VisitVAArgExpr /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:1531:1
#<!-- -->14 0xffffffffee18e260 clang::StmtVisitorBase&lt;llvm::make_const_ptr, (anonymous namespace)::StmtProfiler, void&gt;::Visit(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/include/clang/AST/StmtNodes.inc:1498:1
#<!-- -->15 0xffffffffee1943f0 ~StmtProfiler /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:39:29
#<!-- -->16 0xffffffffee1943f0 ~StmtProfilerWithoutPointers /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:184:9
#<!-- -->17 0xffffffffee1943f0 clang::Stmt::ProcessODRHash(llvm::FoldingSetNodeID&amp;, clang::ODRHash&amp;) const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:2446:1
#<!-- -->18 0xffffffffedf9c21c clang::ODRHash::AddStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/ODRHash.cpp:27:1
#<!-- -->19 0xffffffffedfa90b8 clang::ODRHash::AddFunctionDecl(clang::FunctionDecl const*, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/ODRHash.cpp:727:39
#<!-- -->20 0xffffffffed76ad04 clang::FunctionDecl::setHasODRHash(bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Decl.h:2097:67
#<!-- -->21 0xffffffffed76ad04 clang::FunctionDecl::getODRHash() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/Decl.cpp:4480:16
#<!-- -->22 0xfffffffff301a3d8 clang::ASTDeclWriter::VisitFunctionDecl(clang::FunctionDecl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:712:21
#<!-- -->23 0xfffffffff3027e40 decltype(auto) llvm::dyn_cast&lt;clang::DeclaratorDecl, clang::Decl&gt;(clang::Decl*) /usr/lib/llvm18/include/llvm/Support/Casting.h:662:3
#<!-- -->24 0xfffffffff3027e40 clang::ASTDeclWriter::Visit(clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:279:42
#<!-- -->25 0xfffffffff3028b78 clang::ASTDeclWriter::Emit(clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:50:12
#<!-- -->26 0xfffffffff3028b78 clang::ASTWriter::WriteDecl(clang::ASTContext&amp;, clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:2738:27
#<!-- -->27 0xfffffffff2fc2948 clang::ASTWriter::WriteASTCore(clang::Sema&amp;, llvm::StringRef, clang::Module*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriter.cpp:5095:18
#<!-- -->28 0xfffffffff2fc5a74 clang::ASTWriter::WriteAST(clang::Sema&amp;, llvm::StringRef, clang::Module*, llvm::StringRef, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriter.cpp:4646:11
#<!-- -->29 0xfffffffff30673d4 std::__shared_ptr&lt;clang::PCHBuffer, (__gnu_cxx::_Lock_policy)2&gt;::get() const /usr/include/c++/13.3.0/bits/shared_ptr_base.h:1666:16
#<!-- -->30 0xfffffffff30673d4 std::__shared_ptr_access&lt;clang::PCHBuffer, (__gnu_cxx::_Lock_policy)2, false, false&gt;::_M_get() const /usr/include/c++/13.3.0/bits/shared_ptr_base.h:1363:69
#<!-- -->31 0xfffffffff30673d4 std::__shared_ptr_access&lt;clang::PCHBuffer, (__gnu_cxx::_Lock_policy)2, false, false&gt;::operator-&gt;() const /usr/include/c++/13.3.0/bits/shared_ptr_base.h:1357:15
#<!-- -->32 0xfffffffff30673d4 clang::PCHGenerator::HandleTranslationUnit(clang::ASTContext&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/GeneratePCH.cpp:68:9
#<!-- -->33 0xfffffffff34f8b88 __gnu_cxx::__normal_iterator&lt;std::unique_ptr&lt;clang::ASTConsumer, std::default_delete&lt;clang::ASTConsumer&gt;&gt;*, std::vector&lt;std::unique_ptr&lt;clang::ASTConsumer, std::default_delete&lt;clang::ASTConsumer&gt;&gt;, std::allocator&lt;std::unique_ptr&lt;clang::ASTConsumer, std::default_delete&lt;clang::ASTConsumer&gt;&gt;&gt;&gt;&gt;::operator++() /usr/include/c++/13.3.0/bits/stl_iterator.h:1111:4
#<!-- -->34 0xfffffffff34f8b88 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/MultiplexConsumer.cpp:297:25
#<!-- -->35 0xffffffffece55344 void clang::finalize&lt;std::vector&lt;std::unique_ptr&lt;clang::TemplateInstantiationCallback, std::default_delete&lt;clang::TemplateInstantiationCallback&gt;&gt;, std::allocator&lt;std::unique_ptr&lt;clang::TemplateInstantiationCallback, std::default_delete&lt;clang::TemplateInstantiationCallback&gt;&gt;&gt;&gt;&gt;(std::vector&lt;std::unique_ptr&lt;clang::TemplateInstantiationCallback, std::default_delete&lt;clang::TemplateInstantiationCallback&gt;&gt;, std::allocator&lt;std::unique_ptr&lt;clang::TemplateInstantiationCallback, std::default_delete&lt;clang::TemplateInstantiationCallback&gt;&gt;&gt;&gt;&amp;, clang::Sema const&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/Sema/TemplateInstCallback.h:54:3
#<!-- -->36 0xffffffffece55344 clang::ParseAST(clang::Sema&amp;, bool, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Parse/ParseAST.cpp:183:11
#<!-- -->37 0xfffffffff344ac14 clang::ASTFrontendAction::ExecuteAction() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/FrontendAction.cpp:1185:1
#<!-- -->38 0xfffffffff345339c clang::FrontendAction::Execute() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/FrontendAction.cpp:1069:21
#<!-- -->39 0xfffffffff327df18 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/CompilerInstance.cpp:1057:42
#<!-- -->40 0xfffffffff35d2eb4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:38
#<!-- -->41 0x007b14c4 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/cc1_main.cpp:294:40
#<!-- -->42 0x00797918 ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/driver.cpp:369:35
#<!-- -->43 0x0079bc28 clang_main(int, char**, llvm::ToolContext const&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/driver.cpp:405:26
#<!-- -->44 0x00796678 main /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/tools/driver/clang-driver.cpp:17:20
#<!-- -->45 0xfffffffff7c1caa8 libc_start_main_stage2 /usr/src/packages/system/musl/src/musl-1.2.3/src/env/__libc_start_main.c:95:2
#<!-- -->46 0xfffffffff7c1cb18 __libc_start_main /usr/src/packages/system/musl/src/musl-1.2.3/src/env/__libc_start_main.c:87:1
#<!-- -->47 0x007967b0 _start_c /usr/src/packages/system/musl/src/musl-1.2.3/crt/crt1.c:19:1
#<!-- -->48 0x0079676c _start_c /usr/src/packages/system/musl/src/musl-1.2.3/crt/crt1.c:15:1
AddressSanitizer:DEADLYSIGNAL
=================================================================
==5553==ERROR: AddressSanitizer: SEGV on unknown address 0xffffffff (pc 0xee186130 bp 0xe33539a0 sp 0xffa80930 T0)
==5553==The signal is caused by a UNKNOWN memory access.
    #<!-- -->0 0xee186130 in llvm::isa_impl&lt;clang::BinaryOperator, clang::Stmt, void&gt;::doit(clang::Stmt const&amp;) /usr/lib/llvm18/include/llvm/Support/Casting.h:64
    #<!-- -->1 0xee186130 in llvm::isa_impl_cl&lt;clang::BinaryOperator, clang::Stmt const*&gt;::doit(clang::Stmt const*) /usr/lib/llvm18/include/llvm/Support/Casting.h:110
    #<!-- -->2 0xee186130 in llvm::isa_impl_wrap&lt;clang::BinaryOperator, clang::Stmt const*, clang::Stmt const*&gt;::doit(clang::Stmt const* const&amp;) /usr/lib/llvm18/include/llvm/Support/Casting.h:137
    #<!-- -->3 0xee186130 in llvm::isa_impl_wrap&lt;clang::BinaryOperator, clang::Stmt const* const, clang::Stmt const*&gt;::doit(clang::Stmt const* const&amp;) /usr/lib/llvm18/include/llvm/Support/Casting.h:129
    #<!-- -->4 0xee186130 in llvm::CastIsPossible&lt;clang::BinaryOperator, clang::Stmt const*, void&gt;::isPossible(clang::Stmt const* const&amp;) /usr/lib/llvm18/include/llvm/Support/Casting.h:257
    #<!-- -->5 0xee186130 in llvm::CastInfo&lt;clang::BinaryOperator, clang::Stmt const*, void&gt;::doCastIfPossible(clang::Stmt const* const&amp;) /usr/lib/llvm18/include/llvm/Support/Casting.h:493
    #<!-- -->6 0xee186130 in decltype(auto) llvm::dyn_cast&lt;clang::BinaryOperator, clang::Stmt const&gt;(clang::Stmt const*) /usr/lib/llvm18/include/llvm/Support/Casting.h:663
    #<!-- -->7 0xee186130 in Visit /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/StmtVisitor.h:47
    #<!-- -->8 0xee18ea50 in VisitStmt /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:245
    #<!-- -->9 0xee18dfe4 in VisitDeclStmt /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:252
    #<!-- -->10 0xee18dfe4 in Visit /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/include/clang/AST/StmtNodes.inc:1474
    #<!-- -->11 0xee18ea50 in VisitStmt /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:245
    #<!-- -->12 0xee18e25c in VisitExpr /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:1306
    #<!-- -->13 0xee18e25c in VisitVAArgExpr /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:1530
    #<!-- -->14 0xee18e25c in Visit /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/include/clang/AST/StmtNodes.inc:1498
    #<!-- -->15 0xee1943ec in clang::Stmt::ProcessODRHash(llvm::FoldingSetNodeID&amp;, clang::ODRHash&amp;) const /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/StmtProfile.cpp:2445
    #<!-- -->16 0xedf9c218 in clang::ODRHash::AddStmt(clang::Stmt const*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/ODRHash.cpp:26
    #<!-- -->17 0xedfa90b4 in clang::ODRHash::AddFunctionDecl(clang::FunctionDecl const*, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/ODRHash.cpp:723
    #<!-- -->18 0xed76ad00 in clang::FunctionDecl::getODRHash() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/AST/Decl.cpp:4479
    #<!-- -->19 0xf301a3d4 in clang::ASTDeclWriter::VisitFunctionDecl(clang::FunctionDecl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:712
    #<!-- -->20 0xf3027e3c in clang::ASTDeclWriter::Visit(clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:274
    #<!-- -->21 0xf3028b74 in clang::ASTWriter::WriteDecl(clang::ASTContext&amp;, clang::Decl*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriterDecl.cpp:2735
    #<!-- -->22 0xf2fc2944 in clang::ASTWriter::WriteASTCore(clang::Sema&amp;, llvm::StringRef, clang::Module*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriter.cpp:5095
    #<!-- -->23 0xf2fc5a70 in clang::ASTWriter::WriteAST(clang::Sema&amp;, llvm::StringRef, clang::Module*, llvm::StringRef, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/ASTWriter.cpp:4645
    #<!-- -->24 0xf30673d0 in clang::PCHGenerator::HandleTranslationUnit(clang::ASTContext&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Serialization/GeneratePCH.cpp:68
    #<!-- -->25 0xf34f8b84 in clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/MultiplexConsumer.cpp:298
    #<!-- -->26 0xece55340 in clang::ParseAST(clang::Sema&amp;, bool, bool) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Parse/ParseAST.cpp:176
    #<!-- -->27 0xf344ac10 in clang::ASTFrontendAction::ExecuteAction() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/FrontendAction.cpp:1183
    #<!-- -->28 0xf3453398 in clang::FrontendAction::Execute() /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/FrontendAction.cpp:1069
    #<!-- -->29 0xf327df14 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/Frontend/CompilerInstance.cpp:1057
    #<!-- -->30 0xf35d2eb0 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272
    #<!-- -->31 0x7b14c0 in cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/cc1_main.cpp:294
    #<!-- -->32 0x797914 in ExecuteCC1Tool /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/driver.cpp:365
    #<!-- -->33 0x79bc24 in clang_main(int, char**, llvm::ToolContext const&amp;) /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/tools/driver/driver.cpp:405
    #<!-- -->34 0x796674 in main /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/tools/driver/clang-driver.cpp:17
    #<!-- -->35 0xf7c1caa4 in libc_start_main_stage2 src/env/__libc_start_main.c:95

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/lib/llvm18/include/llvm/Support/Casting.h:64 in llvm::isa_impl&lt;clang::BinaryOperator, clang::Stmt, void&gt;::doit(clang::Stmt const&amp;)
==5553==ABORTING

--

</p>
</details>

<details><summary>UBSan output</summary>
<p>

********************
FAIL: Clang :: Analysis/malloc.c (954 of 19831)
******************** TEST 'Clang :: Analysis/malloc.c' FAILED ********************
Exit Code: 139

Command Output (stderr):
--
RUN: at line 1: /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -Wno-strict-prototypes -Wno-error=implicit-int -verify /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Analysis/malloc.c    -analyzer-checker=core    -analyzer-checker=alpha.deadcode.UnreachableCode    -analyzer-checker=alpha.core.CastSize    -analyzer-checker=unix    -analyzer-checker=debug.ExprInspection
+ /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -Wno-strict-prototypes -Wno-error=implicit-int -verify /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Analysis/malloc.c -analyzer-checker=core -analyzer-checker=alpha.deadcode.UnreachableCode -analyzer-checker=alpha.core.CastSize -analyzer-checker=unix -analyzer-checker=debug.ExprInspection
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd158d928 which does not point to an object of type 'TranslationUnitDecl'
0xd158d928: note: object is of type 'clang::Decl'
 00 00 00 00  ef 84 de b8 00 00 00 00  00 00 00 00 00 00 00 00  00 06 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~
              vptr for 'clang::Decl'
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd158dd50 which does not point to an object of type 'TagDecl'
0xd158dd50: note: object is of type 'clang::TypeDecl'
 00 00 00 00  ef 84 dc a8 00 00 00 00  d1 58 d9 40 00 00 00 00  6e 06 00 18 00 00 00 00  d1 54 55 f8
              ^~~~~~~~~~~
              vptr for 'clang::TypeDecl'
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd158df40 which does not point to an object of type 'TypedefNameDecl'
0xd158df40: note: object is of type 'clang::TypeDecl'
 00 00 00 00  ef 84 dc a8 00 00 00 00  d1 58 d9 40 00 00 00 00  7a 06 00 90 00 00 00 00  d1 54 55 c8
              ^~~~~~~~~~~
              vptr for 'clang::TypeDecl'
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd158e670 which does not point to an object of type 'VarDecl'
0xd158e670: note: object is of type 'clang::DeclaratorDecl'
 00 00 fe 74  ef 84 d8 68 00 00 00 00  d1 58 d9 40 00 00 fe 7a  4a 06 00 80 00 00 00 00  d1 52 5d c8
              ^~~~~~~~~~~
              vptr for 'clang::DeclaratorDecl'
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Redeclarable.h:200:15: runtime error: downcast of address 0xd1511670 which does not point to an object of type 'FunctionDecl'
0xd1511670: note: object is of type 'clang::DeclaratorDecl'
 00 a2 02 66  ef 84 d8 68 00 00 00 00  d1 58 d9 40 00 00 ff 46  3e 06 00 80 00 00 00 00  d1 55 c8 38
              ^~~~~~~~~~~
              vptr for 'clang::DeclaratorDecl'
/usr/lib/llvm18/include/llvm/Support/Casting.h:110:36: runtime error: reference binding to misaligned address 0xffffffff for type 'const struct Stmt', which requires 4 byte alignment
0xffffffff: note: pointer points here
&lt;memory cannot be printed&gt;
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Expr.h:3980:27: runtime error: member call on misaligned address 0xffffffff for type 'const struct Stmt', which requires 4 byte alignment
0xffffffff: note: pointer points here
&lt;memory cannot be printed&gt;
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/include/clang/AST/Stmt.h:1357:44: runtime error: member access within misaligned address 0xffffffff for type 'const struct Stmt', which requires 4 byte alignment
0xffffffff: note: pointer points here
&lt;memory cannot be printed&gt;
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/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -Wno-strict-prototypes -Wno-error=implicit-int -verify /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Analysis/malloc.c -analyzer-checker=core -analyzer-checker=alpha.deadcode.UnreachableCode -analyzer-checker=alpha.core.CastSize -analyzer-checker=unix -analyzer-checker=debug.ExprInspection
1.	&lt;eof&gt; parser at end of file
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM.so.18.1      0xd4dcb8e0 llvm::sys::RunSignalHandlers() + 124
1  libLLVM.so.18.1      0xd4dcbd74
2                       0x001023c4 __kernel_sigtramp32 + 0
3  libclang-cpp.so.18.1 0xe305db7c
4  libclang-cpp.so.18.1 0xe3fd2c3c
5  libclang-cpp.so.18.1 0xed3a75f8
6  libclang-cpp.so.18.1 0xed3b2b88
7  libclang-cpp.so.18.1 0xed3b2b88
8  libclang-cpp.so.18.1 0xed3b2a04
9  libclang-cpp.so.18.1 0xecf5dad8
10 libclang-cpp.so.18.1 0xecf4bdd8 clang::ento::CheckerManager::runCheckersOnASTBody(clang::Decl const*, clang::ento::AnalysisManager&amp;, clang::ento::BugReporter&amp;) + 728
11 libclang-cpp.so.18.1 0xee2bf654
12 libclang-cpp.so.18.1 0xee2c2b90
13 libclang-cpp.so.18.1 0xee2c74f4
14 libclang-cpp.so.18.1 0xee325370
15 libclang-cpp.so.18.1 0xe2f50e30 clang::ParseAST(clang::Sema&amp;, bool, bool) + 3260
16 libclang-cpp.so.18.1 0xec1770d0 clang::ASTFrontendAction::ExecuteAction() + 4884
17 libclang-cpp.so.18.1 0xec17e988 clang::FrontendAction::Execute() + 3448
18 libclang-cpp.so.18.1 0xebfcad9c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) + 6048
19 libclang-cpp.so.18.1 0xec3b68a8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4248
20 clang                0x00ae9cfc cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) + 13956
21 clang                0x00acc34c
22 clang                0x00acef54 clang_main(int, char**, llvm::ToolContext const&amp;) + 1184
23 clang                0x00acaf14 main + 148
24 ld-musl-powerpc.so.1 0xf79d3aa8
25 ld-musl-powerpc.so.1 0xf79d3b18 __libc_start_main + 108
26 clang                0x00acafb8 _start_c + 68
27 clang                0x00acaf74 _start_c + 0
/home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/test/Analysis/Output/malloc.c.script: line 1:  9067 Segmentation fault      /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/bin/clang -cc1 -internal-isystem /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/build/lib/clang/18/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -Wno-strict-prototypes -Wno-error=implicit-int -verify /home/awilcox/Code/awilfox/rust-next/user/clang/src/llvm-project-18.1.8.src/clang/test/Analysis/malloc.c -analyzer-checker=core -analyzer-checker=alpha.deadcode.UnreachableCode -analyzer-checker=alpha.core.CastSize -analyzer-checker=unix -analyzer-checker=debug.ExprInspection

--

</p>
</details>

Clang 16 works fine, so I bisected through:

<details><summary>Bisection log</summary>
<p>

# bad: [e19b7dc36bc047b9eb72078d034596be766da350] Bump version to 17.0.1
# good: [603c286334b07f568d39f6706c848f576914f323] Bump the trunk major version to 17
git bisect start 'llvmorg-17.0.1' 'llvmorg-17-init'
# bad: [3db96aa89e5103730d929dd2ba668af26753e2a4] [LangRef] Fix broken tail call optimization link
git bisect bad 3db96aa89e5103730d929dd2ba668af26753e2a4
# good: [c09730c23e207accbf487a5142647c118630a5d2] [RISCV] Pre-commit tests for D145897. NFC
git bisect good c09730c23e207accbf487a5142647c118630a5d2
# bad: [b04bc87c9edca0e93330948b88292ebcde891ce2] [lldb][NFC] Delete unused function Breakpoint::GetEventIdentifier
git bisect bad b04bc87c9edca0e93330948b88292ebcde891ce2
# skip: [74c0bd240499683078d4f15d31de690950da8231] [RISCV] Remove UpperBound from SchedMxList and create WorstCaseBehavior records
git bisect skip 74c0bd240499683078d4f15d31de690950da8231
# good: [8d93cbed6e383d5a8b5985f9087cb31ffd5ac7f5] [InstCombine] Precommit tests
git bisect good 8d93cbed6e383d5a8b5985f9087cb31ffd5ac7f5
# good: [a3252d1a2c568792974a4bc7413b0c61a43053e9] [lldb][NFC] Move various constructor definitions from .h to .cpp
git bisect good a3252d1a2c568792974a4bc7413b0c61a43053e9
# bad: [c75d36e8271558492d78d22e5659fbb542ca103e] [Hexagon] Convert some tests to opaque pointers (NFC)
git bisect bad c75d36e8271558492d78d22e5659fbb542ca103e
# bad: [9fecbd4ae69e0d41dd94250b0224ce0814f92d9d] [X86] vector-compare-any_of.ll - add AVX1OR2 check-prefix and make AVX a common check-prefix
git bisect bad 9fecbd4ae69e0d41dd94250b0224ce0814f92d9d
# bad: [6261adfa51f2d93c8258e7b2d9811d607f3e50a5] [InstCombine] Fold more intrinsics over selects
git bisect bad 6261adfa51f2d93c8258e7b2d9811d607f3e50a5
# bad: [46cfdfb5f799d01ffe902dc8f2b66b3d9c7eec4f] [mlir][Linalg] Fix Generalize transform
git bisect bad 46cfdfb5f799d01ffe902dc8f2b66b3d9c7eec4f
# bad: [00701d32b7a495a69a420e0d9958ab15091da028] [RISCV] Remove -mattr=+f from rvk-user-csr-name.s.
git bisect bad 00701d32b7a495a69a420e0d9958ab15091da028
# bad: [7df3c71b508b65284483225685f1ba19777f2bbb] [clang] Fix 2 bugs with parenthesized aggregate initialization
git bisect bad 7df3c71b508b65284483225685f1ba19777f2bbb
# good: [72c662a47f101712c203de782da34029d29e081f] [mlir][vector][NFC] Clean up vector gather lowering comments
git bisect good 72c662a47f101712c203de782da34029d29e081f
# bad: [b24e2900fa743e0abab7f4fa9747e5cbbfc2567a] [lldb] Fix macos build after e64cc756819d (2/2)
git bisect bad b24e2900fa743e0abab7f4fa9747e5cbbfc2567a
# bad: [2ea8a3a56a513484ee36c8ad12f93f35665321d1] [lld][WebAssembly] Process stub libraries before performing LTO
git bisect bad 2ea8a3a56a513484ee36c8ad12f93f35665321d1
# bad: [bc73ef0031b50f7443615fef614fb4ecaaa4bd11] PR60985: Fix merging of lambda closure types across modules.
git bisect bad bc73ef0031b50f7443615fef614fb4ecaaa4bd11
# first bad commit: [bc73ef0031b50f7443615fef614fb4ecaaa4bd11] PR60985: Fix merging of lambda closure types across modules.

</p>
</details>

and found that #60985 was the culprit. Looking at the code, I immediately saw the issue. The Ptr value in LazyOffsetPtr is 64-bits (uint64_t), and the new method getAddressOfPointer returns a reference to Ptr as a pointer-to-pointer. The problem is that on 32-bit big endian platforms (such as PPC), pointing to Ptr will read the top 32 bits of the value, not the bottom 32 bits.

@somerandomengineer
Copy link

Hi I am new here and would like to work on this issue. Could you please assign this to me? Will try my best to resolve it.

@thesamesam
Copy link
Member

@minhlongng123 There's already a PR for it at #111995.

@mgorny
Copy link
Member

mgorny commented Oct 19, 2024

/cherry-pick 7619699

@llvmbot llvmbot closed this as completed Oct 19, 2024
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in LLVM Release Status Oct 19, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 19, 2024

/pull-request #113052

tru pushed a commit to llvmbot/llvm-project that referenced this issue Oct 29, 2024
LazyOffsetPtr currently relies on uint64_t being able to store a pointer
and, unless sizeof(uint64_t) == sizeof(void *), little endianness, since
getAddressOfPointer reinterprets the memory as a pointer. This also
doesn't properly respect the C++ object model.

As removing getAddressOfPointer would have wide-reaching implications,
improve the implementation to account for these problems by using
placement new and a suitably sized-and-aligned buffer, "right"-aligning
the objects on big-endian platforms so the LSBs are in the same place
for use as the discriminator.

Fixes: bc73ef0
Fixes: llvm#111993
(cherry picked from commit 7619699)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] release:backport
Projects
6 participants