Issue 125626
Summary crash when compiling with emit-cir and fsanitize=undefined
Labels new issue
Assignees
Reporter midnightveil
    https://godbolt.org/z/azdrjn3Wf

```
clang version 20.0.0git (https://github.com/llvm/clangir.git c4e58420474090601b9419159ad3343ffb530c34)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-clangir-trunk-20250201/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 (in-process)
 "/opt/compiler-explorer/clang-clangir-trunk-20250201/bin/clang-20" -cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -clear-ast-before-backend -main-file-name example.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -v -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-clangir-trunk-20250201/lib/clang/20 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward -internal-isystem /opt/compiler-explorer/clang-clangir-trunk-20250201/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -fclangir -emit-cir -mllvm --x86-asm-syntax=intel -fsanitize=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr -fsanitize-recover=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,vptr -fsanitize-merge=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /app/output.s -x c++ <source>
clang -cc1 version 20.0.0git based upon LLVM 20.0.0git default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11
 /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11
 /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward
 /opt/compiler-explorer/clang-clangir-trunk-20250201/lib/clang/20/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
NYI
UNREACHABLE executed at /root/llvm-project/clang/lib/CIR/CodeGen/CIRGenFunction.cpp:1170!
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: /opt/compiler-explorer/clang-clangir-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S -Xclang -fclangir -fcolor-diagnostics -fno-crash-diagnostics -Xclang -emit-cir -v -fsanitize=undefined <source>
1.	<eof> parser at end of file
2.	<source>:2:5: LLVM IR generation of declaration 'main'
 #0 0x0000000002e67b9b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x2e67b9b)
 #1 0x0000000002e65104 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x2e65104)
 #2 0x0000000002dac710 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000077f9a3242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000077f9a32969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000077f9a3242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000077f9a32287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000000002db857a (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x2db857a)
 #8 0x000000000474e500 clang::CIRGen::CIRGenFunction::StartFunction(clang::GlobalDecl, clang::QualType, cir::FuncOp, clang::CIRGen::CIRGenFunctionInfo const&, clang::CIRGen::FunctionArgList const&, clang::SourceLocation, clang::SourceLocation) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x474e500)
 #9 0x0000000004751618 clang::CIRGen::CIRGenFunction::generateCode(clang::GlobalDecl, cir::FuncOp, clang::CIRGen::CIRGenFunctionInfo const&) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x4751618)
#10 0x0000000004683d18 clang::CIRGen::CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl, mlir::Operation*) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x4683d18)
#11 0x0000000004688027 clang::CIRGen::CIRGenModule::emitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x4688027)
#12 0x0000000004688547 clang::CIRGen::CIRGenModule::emitTopLevelDecl(clang::Decl*) (.part.0) CIRGenModule.cpp:0:0
#13 0x0000000004668083 cir::CIRGenerator::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x4668083)
#14 0x00000000045017ac cir::CIRGenConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x45017ac)
#15 0x0000000006955694 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x6955694)
#16 0x0000000003b2e9d3 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x3b2e9d3)
#17 0x0000000003aab326 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x3aab326)
#18 0x0000000003c15c4e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x3c15c4e)
#19 0x0000000001116d64 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x1116d64)
#20 0x000000000110dbe0 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x0000000003860799 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#22 0x0000000002dacb72 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x2dacb72)
#23 0x0000000003862b4e clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#24 0x000000000381d47b clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x381d47b)
#25 0x000000000381e4ef clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x381e4ef)
#26 0x000000000382a914 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x382a914)
#27 0x0000000001112ea2 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x1112ea2)
#28 0x00000000010026b3 main (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x10026b3)
#29 0x000077f9a3229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#30 0x000077f9a3229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#31 0x000000000110d205 _start (/opt/compiler-explorer/clang-clangir-trunk/bin/clang+++0x110d205)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to