Skip to content

Segmentation fault during running llvm-spirv #357

@davidrohr

Description

@davidrohr

The attached test case segfaults for me while running llvm-spirv (Using current master llvm-spirv and latest clang from git commit c78da41cdae532adb51d10ed73482642881346dd + the fixes from https://bugs.llvm.org/show_bug.cgi?id=43145).
test.tar.gz

Commands to reproduce:

clang++ -cl-std=clc++ -x cl -emit-llvm --target=spir64-unknown-unknown -cl-denorms-are-zero -cl-mad-enable -cl-no-signed-zeros -ferror-limit=1000 -Xclang -finclude-default-header -Dcl_clang_storage_class_specifiers -Wno-invalid-constexpr -c test.cl -o test.bc
llvm-spirv test.bc

I am getting the following segfault:

Stack dump:
0.      Program arguments: llvm-spirv test.bc 
1.      Running pass 'LLVMToSPIRV' on module 'test.bc'.
 #0 0x00007f1a027c995a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib/llvm/10/lib64/libLLVM-10svn.so+0xa3e95a)
 #1 0x00007f1a027c7924 llvm::sys::RunSignalHandlers() (/usr/lib/llvm/10/lib64/libLLVM-10svn.so+0xa3c924)
 #2 0x00007f1a027c7aa5 (/usr/lib/llvm/10/lib64/libLLVM-10svn.so+0xa3caa5)
 #3 0x00007f1a018f10d0 (/lib64/libc.so.6+0x390d0)
 #4 0x000055cfd6eb9c86 SPIRV::SPIRVModuleImpl::addUnaryInst(spv::Op, SPIRV::SPIRVType*, SPIRV::SPIRVValue*, SPIRV::SPIRVBasicBlock*) (/usr/bin/llvm-spirv+0x23bc86)
 #5 0x000055cfd6e54446 SPIRV::LLVMToSPIRV::transValueWithoutDecoration(llvm::Value*, SPIRV::SPIRVBasicBlock*, bool) (/usr/bin/llvm-spirv+0x1d6446)
 #6 0x000055cfd6e5533d (/usr/bin/llvm-spirv+0x1d733d)
 #7 0x000055cfd6e5ce4f SPIRV::LLVMToSPIRV::transFunction(llvm::Function*) (/usr/bin/llvm-spirv+0x1dee4f)
 #8 0x000055cfd6e5d73c SPIRV::LLVMToSPIRV::translate() (/usr/bin/llvm-spirv+0x1df73c)
 #9 0x000055cfd6e5d8f3 SPIRV::LLVMToSPIRV::runOnModule(llvm::Module&) (/usr/bin/llvm-spirv+0x1df8f3)
#10 0x00007f1a028d06fe llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm/10/lib64/libLLVM-10svn.so+0xb456fe)
#11 0x000055cfd6e5da16 llvm::writeSpirv(llvm::Module*, SPIRV::TranslatorOpts const&, std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/usr/bin/llvm-spirv+0x1dfa16)
#12 0x000055cfd6dc80de main (/usr/bin/llvm-spirv+0x14a0de)
#13 0x00007f1a018dbe5b __libc_start_main (/lib64/libc.so.6+0x23e5b)
#14 0x000055cfd6dcc1ca _start (/usr/bin/llvm-spirv+0x14e1ca)
Segmentation fault

@svenvh @AnastasiaStulova : This is the follow-up bug report to https://bugs.llvm.org/show_bug.cgi?id=43145. This currently blocks my test with SPIR-V.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions