Open
Description
Clang-20 crashed with preserve_most
atrribute and -m16
.
Compiler explorer: https://godbolt.org/z/o8afxa8dP
$cat mutant.c
int __attribute__((preserve_most)) a(char c) {
for (;;)
;
}
Also crashed on clang-19.
$clang-19 -m16 mutant.c
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: /usr/lib/llvm-19/bin/clang -cc1 -triple i386-pc-linux-code16 -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name mutant.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu i686 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/code/InsertAttr -fcoverage-compilation-dir=/home/code/InsertAttr -resource-dir /usr/lib/llvm-19/lib/clang/19 -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/mutant-c2a10a.o -x c mutant.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'mutant.c'.
4. Running pass 'Check CFA info and insert CFI instructions if needed' on function '@a'
#0 0x00007fbef0259246 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea7246)
#1 0x00007fbef0256e20 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea4e20)
#2 0x00007fbef025990b (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea790b)
#3 0x00007fbeeee91520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007fbef04cce7e (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x111ae7e)
#5 0x00007fbef0639738 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0x1287738)
#6 0x00007fbef03a76f4 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xff56f4)
#7 0x00007fbef03acfe3 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xffafe3)
#8 0x00007fbef03a7e4e llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xff5e4e)
#9 0x00007fbef8d64c7e clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1e20c7e)
#10 0x00007fbef910a132 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x21c6132)
#11 0x00007fbef7b73739 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc2f739)
#12 0x00007fbef9c060b5 clang::FrontendAction::Execute() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2cc20b5)
#13 0x00007fbef9b762f4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2c322f4)
#14 0x00007fbef9c82dee clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2d3edee)
#15 0x00005635aba7dbc5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-19/bin/clang+0x11bc5)
#16 0x00005635aba7aad5 (/usr/lib/llvm-19/bin/clang+0xead5)
#17 0x00005635aba79c9b clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-19/bin/clang+0xdc9b)
#18 0x00005635aba87f36 main (/usr/lib/llvm-19/bin/clang+0x1bf36)
#19 0x00007fbeeee78d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x00007fbeeee78e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x00005635aba78765 _start (/usr/lib/llvm-19/bin/clang+0xc765)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Ubuntu clang version 19.0.0 (++20240722031324+65825cd5431c-1~exp1~20240722151445.1819)
Target: i386-pc-linux-code16
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/mutant-a90822.c
clang: note: diagnostic msg: /tmp/mutant-a90822.sh
clang: note: diagnostic msg:
********************