Issue |
147346
|
Summary |
[crash] clang reproducer.ll (X86 DAG->DAG Instruction Selection)
|
Labels |
clang
|
Assignees |
|
Reporter |
attila-lendvai
|
`clang -O` doesn't crash, but `clang` and `clang -g` does.
```
$ clang --version
clang version 20.1.7
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/bin
```
```
$ uname -a
Linux foo 6.14.11 #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux
```
```
$ guix describe
Generation 231 Jul 06 2025 13:09:57 (current)
guix 50b7528
repository URL: https://codeberg.org/guix/guix.git
branch: master
commit: 50b75285883623ee244d0a71a225807c0672ac33
```
```
$ clang test.ll
warning: overriding the module target triple with x86_64-unknown-linux-gnu [-Woverride-module]
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: /gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name eval1.ll -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 x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/alendvai/common-lisp/maru -fcoverage-compilation-dir=/home/alendvai/common-lisp/maru -resource-dir /gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/lib/clang/20 -ferror-limit 19 -fmessage-length=159 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/eval1-3d1a00.o -x ir build/llvm-linux/64bit-le/eval1.ll
1. Code generation
2. Running pass 'Function Pass Manager' on module 'build/llvm-linux/64bit-le/eval1.ll'.
3. Running pass 'X86 DAG->DAG Instruction Selection' on function '@memset'
#0 0x00007f7eab5fe1eb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0xbfe1eb)
#1 0x00007f7eab5fb98d (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0xbfb98d)
#2 0x00007f7eaa860560 __restore_rt (/gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2.39/lib/libc.so.6+0x3e560)
#3 0x00007f7eabfdd3d6 llvm::FastISel::handlePHINodesInSuccessorBlocks(llvm::BasicBlock const*) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0x15dd3d6)
#4 0x00007f7eabfe12a4 llvm::FastISel::selectInstruction(llvm::Instruction const*) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0x15e12a4)
#5 0x00007f7eac1e8ced llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0x17e8ced)
#6 0x00007f7eac1ea7e9 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0x17ea7e9)
#7 0x00007f7eac1da09d llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0x17da09d)
#8 0x00007f7eabb60d65 (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0x1160d65)
#9 0x00007f7eab7bee72 llvm::FPPassManager::runOnFunction(llvm::Function&) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0xdbee72)
#10 0x00007f7eab7bf02c llvm::FPPassManager::runOnModule(llvm::Module&) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0xdbf02c)
#11 0x00007f7eab7bfa27 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/gnu/store/gvpppzhpsd0aflsimq7c479cg6r1zm64-llvm-20.1.7/lib/libLLVM.so.20.1+0xdbfa27)
#12 0x00007f7eb61c6b12 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, 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*) (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/lib/libclang-cpp.so.20.1+0x23c6b12)
#13 0x00007f7eb66e6c83 clang::CodeGenAction::ExecuteAction() (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/lib/libclang-cpp.so.20.1+0x28e6c83)
#14 0x00007f7eb71126d1 clang::FrontendAction::Execute() (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/lib/libclang-cpp.so.20.1+0x33126d1)
#15 0x00007f7eb7081c2b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/lib/libclang-cpp.so.20.1+0x3281c2b)
#16 0x00007f7eb71ab8d3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/lib/libclang-cpp.so.20.1+0x33ab8d3)
#17 0x00000000004169ce cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/bin/clang-20+0x4169ce)
#18 0x000000000040e6b2 (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/bin/clang-20+0x40e6b2)
#19 0x0000000000411f3e clang_main(int, char**, llvm::ToolContext const&) (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/bin/clang-20+0x411f3e)
#20 0x000000000040e104 main (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/bin/clang-20+0x40e104)
#21 0x00007f7eaa84bbf7 __libc_start_call_main (/gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2.39/lib/libc.so.6+0x29bf7)
#22 0x00007f7eaa84bcac __libc_start_main@GLIBC_2.2.5 (/gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2.39/lib/libc.so.6+0x29cac)
#23 0x000000000040e141 _start (/gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/bin/clang-20+0x40e141)
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 20.1.7
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /gnu/store/hvi2iz7n4zk4pyxvibrxa6j43hkv4wn2-clang-20.1.7/bin
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
```
test.ll
```
%word = type i64
%oop = type ptr
define weak dso_local ptr @memset(ptr %dst, i32 %val, %word %len) {
entry:
%end = getelementptr i8, ptr %dst, %word %len
br label %loop
loop:
%cur = phi ptr [ %dst, %entry ], [ %next, %loop ]
%done = icmp eq ptr %cur, %end
br i1 %done, label %exit, label %store
store:
%val8 = trunc i32 %val to i8
store i8 %val8, ptr %cur
%next = getelementptr i8, ptr %cur, %word 1
br label %loop
exit:
ret ptr %dst
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs