| Issue |
88038
|
| Summary |
[Clang] Segfault with `-fcoverage-mapping -fcs-profile-generate -fprofile-instr-generate`
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
patrick-rivos
|
Testcase:
```c
int main()
{
return 0;
}
```
Backtrace:
```
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: /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19 -cc1 -triple riscv64-unknown-linux-gnu -emit-obj -mrelax-all -dumpdir rv64gcv.out- -disable-free -clear-ast-before-backend -main-file-name red.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 generic-rv64 -target-feature +m -target-feature +a -target-feature +f -target-feature +d -target-feature +c -target-feature +zicsr -target-feature -e -target-feature -h -target-feature -shcounterenw -target-feature -shgatpa -target-feature -shtvala -target-feature -shvsatpa -target-feature -shvstvala -target-feature -shvstvecd -target-feature -smaia -target-feature -smepmp -target-feature -ssaia -target-feature -ssccptr -target-feature -sscofpmf -target-feature -sscounterenw -target-feature -ssstateen -target-feature -ssstrict -target-feature -sstc -target-feature -sstvala -target-feature -sstvecd -target-feature -ssu64xl -target-feature -svade -target-feature -svadu -target-feature -svbare -target-feature -svinval -target-feature -svnapot -target-feature -svpbmt -target-feature -v -target-feature -xcvalu -target-feature -xcvbi -target-feature -xcvbitmanip -target-feature -xcvelw -target-feature -xcvmac -target-feature -xcvmem -target-feature -xcvsimd -target-feature -xsfcease -target-feature -xsfvcp -target-feature -xsfvfnrclipxfqf -target-feature -xsfvfwmaccqqq -target-feature -xsfvqmaccdod -target-feature -xsfvqmaccqoq -target-feature -xsifivecdiscarddlone -target-feature -xsifivecflushdlone -target-feature -xtheadba -target-feature -xtheadbb -target-feature -xtheadbs -target-feature -xtheadcmo -target-feature -xtheadcondmov -target-feature -xtheadfmemidx -target-feature -xtheadmac -target-feature -xtheadmemidx -target-feature -xtheadmempair -target-feature -xtheadsync -target-feature -xtheadvdot -target-feature -xventanacondops -target-feature -za128rs -target-feature -za64rs -target-feature -zacas -target-feature -zawrs -target-feature -zba -target-feature -zbb -target-feature -zbc -target-feature -zbkb -target-feature -zbkc -target-feature -zbkx -target-feature -zbs -target-feature -zca -target-feature -zcb -target-feature -zcd -target-feature -zce -target-feature -zcf -target-feature -zcmp -target-feature -zcmt -target-feature -zdinx -target-feature -zfa -target-feature -zfh -target-feature -zfhmin -target-feature -zfinx -target-feature -zhinx -target-feature -zhinxmin -target-feature -zic64b -target-feature -zicbom -target-feature -zicbop -target-feature -zicboz -target-feature -ziccamoa -target-feature -ziccif -target-feature -zicclsm -target-feature -ziccrse -target-feature -zicntr -target-feature -zicond -target-feature -zifencei -target-feature -zihintntl -target-feature -zihintpause -target-feature -zihpm -target-feature -zk -target-feature -zkn -target-feature -zknd -target-feature -zkne -target-feature -zknh -target-feature -zkr -target-feature -zks -target-feature -zksed -target-feature -zksh -target-feature -zkt -target-feature -zmmul -target-feature -zvbb -target-feature -zvbc -target-feature -zve32f -target-feature -zve32x -target-feature -zve64d -target-feature -zve64f -target-feature -zve64x -target-feature -zvfh -target-feature -zvfhmin -target-feature -zvkb -target-feature -zvkg -target-feature -zvkn -target-feature -zvknc -target-feature -zvkned -target-feature -zvkng -target-feature -zvknha -target-feature -zvknhb -target-feature -zvks -target-feature -zvksc -target-feature -zvksed -target-feature -zvksg -target-feature -zvksh -target-feature -zvkt -target-feature -zvl1024b -target-feature -zvl128b -target-feature -zvl16384b -target-feature -zvl2048b -target-feature -zvl256b -target-feature -zvl32768b -target-feature -zvl32b -target-feature -zvl4096b -target-feature -zvl512b -target-feature -zvl64b -target-feature -zvl65536b -target-feature -zvl8192b -target-feature -experimental-smmpm -target-feature -experimental-smnpm -target-feature -experimental-ssnpm -target-feature -experimental-sspm -target-feature -experimental-ssqosid -target-feature -experimental-supm -target-feature -experimental-zaamo -target-feature -experimental-zabha -target-feature -experimental-zalasr -target-feature -experimental-zalrsc -target-feature -experimental-zcmop -target-feature -experimental-zfbfmin -target-feature -experimental-zicfilp -target-feature -experimental-zicfiss -target-feature -experimental-zimop -target-feature -experimental-ztso -target-feature -experimental-zvfbfmin -target-feature -experimental-zvfbfwma -target-feature +relax -target-abi lp64d -msmall-data-limit 8 -debugger-tuning=gdb -fdebug-compilation-dir=/scratch/tc-testing/compiler-fuzz-ci/csmith-discoveries/llvm-rand-opt-12-7 -fprofile-instrument=clang -fprofile-instrument=csllvm -fcoverage-mapping -fcoverage-compilation-dir=/scratch/tc-testing/compiler-fuzz-ci/csmith-discoveries/llvm-rand-opt-12-7 -resource-dir /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/lib/clang/19 -isysroot /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/../sysroot -internal-isystem /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/lib/clang/19/include -internal-isystem /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/../sysroot/usr/local/include -internal-isystem /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/../sysroot/lib/gcc/riscv64-unknown-linux-gnu/14.0.1/../../../../riscv64-unknown-linux-gnu/include -internal-externc-isystem /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/../sysroot/include -internal-externc-isystem /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/../sysroot/usr/include -w -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /scratch/tmp/red-821828.o -x c red.c
1. <eof> parser at end of file
2. Per-file LLVM IR generation
#0 0x00006451a8f09730 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x1e50730)
#1 0x00006451a8f06b3f llvm::sys::RunSignalHandlers() (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x1e4db3f)
#2 0x00006451a8f06c95 SignalHandler(int) Signals.cpp:0:0
#3 0x00007bcb42a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00006451a88a1e53 llvm::ConstantArray::getImpl(llvm::ArrayType*, llvm::ArrayRef<llvm::Constant*>) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x17e8e53)
#5 0x00006451a88a7bc6 llvm::ConstantArray::get(llvm::ArrayType*, llvm::ArrayRef<llvm::Constant*>) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x17eebc6)
#6 0x00006451a9322b9b clang::CodeGen::CoverageMappingModuleGen::emit() (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x2269b9b)
#7 0x00006451a92d61e0 clang::CodeGen::CodeGenModule::Release() (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x221d1e0)
#8 0x00006451a9785f26 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#9 0x00006451a9783793 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x26ca793)
#10 0x00006451ab40215c clang::ParseAST(clang::Sema&, bool, bool) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x434915c)
#11 0x00006451a9a1b539 clang::FrontendAction::Execute() (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x2962539)
#12 0x00006451a999f856 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x28e6856)
#13 0x00006451a9aecee5 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0x2a33ee5)
#14 0x00006451a7db6eaf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0xcfdeaf)
#15 0x00006451a7db0593 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#16 0x00006451a7db330f clang_main(int, char**, llvm::ToolContext const&) (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0xcfa30f)
#17 0x00006451a7cf19eb main (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0xc389eb)
#18 0x00007bcb42a29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#19 0x00007bcb42a29e40 call_init ./csu/../csu/libc-start.c:128:20
#20 0x00007bcb42a29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#21 0x00006451a7daf845 _start (/scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/bin/clang-19+0xcf6845)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 1b761205f2686516cebadbcbc37f798197d9c482)
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /scratch/tc-testing/tc-apr-4/build-rv64gcv/build-llvm-linux/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: /scratch/tmp/red-935bc8.c
clang: note: diagnostic msg: /scratch/tmp/red-935bc8.sh
clang: note: diagnostic msg:
********************
```
Godbolt: https://godbolt.org/z/8je4971YM
Reproducer:
[red-935bc8.zip](https://github.com/llvm/llvm-project/files/14910724/red-935bc8.zip)
Found via fuzzer.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs