Issue 235290
Summary [CodeGen] Assertion `getLangOpts().OpenMPIsTargetDevice && "OpenMP AMDGPU/NVPTX/SPIRV is only prepared to deal with device code."' failed.
Labels clang:codegen, crash
Assignees
Reporter k-arrows
    Using `-fsycl -fopenmp-simd` results in a crash:
https://godbolt.org/z/nj1hPdTd4

Backtrace:
```console
clang-24: /root/llvm-project/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:746: void clang::CodeGen::CodeGenModule::createOpenMPRuntime(): Assertion `getLangOpts().OpenMPIsTargetDevice && "OpenMP AMDGPU/NVPTX/SPIRV is only prepared to deal with device code."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0.	Program arguments: /cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24 -cc1 -triple spirv64-unknown-unknown -aux-triple x86_64-unknown-linux-gnu -fsycl-is-device -O2 -sycl-std=2020 -Wspir-compat -emit-llvm -disable-free -clear-ast-before-backend -main-file-name example.cpp -mrelocation-model static -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -aux-target-cpu x86-64 -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/lib/clang/24 -internal-isystem /cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/../include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/17.0.0/../../../../include/c++/17.0.0 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/17.0.0/../../../../include/c++/17.0.0/x86_64-linux-gnu -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/17.0.0/../../../../include/c++/17.0.0/backward -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/17.0.0/../../../../include/c++/17.0.0 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/17.0.0/../../../../include/c++/17.0.0/x86_64-linux-gnu -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/17.0.0/../../../../include/c++/17.0.0/backward -internal-isystem /cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/lib/clang/24/include -internal-isystem /cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/../include/x86_64-unknown-linux-gnu -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/17.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -internal-isystem /cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/lib/clang/24/include -internal-isystem /cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/../include/x86_64-unknown-linux-gnu -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/17.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++17 -fdeprecated-macro -ferror-limit 19 -fopenmp-simd -fgpu-rdc -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -mllvm --x86-asm-syntax=intel -o /tmp/example-6c4651.ll -x c++ <source>
 #0 0x0000000004ead098 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x4ead098)
 #1 0x0000000004eaa2f4 llvm::sys::RunSignalHandlers() (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x4eaa2f4)
 #2 0x0000000004eaa46e SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000000004eaa518 SignalHandlerTerminate(int, siginfo_t*, void*) Signals.cpp:0:0
 #4 0x00007faafba45330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #5 0x00007faafba9ec0c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9ec0c)
 #6 0x00007faafba4527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
 #7 0x00007faafba288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
 #8 0x00007faafba2881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
 #9 0x00007faafba3b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
#10 0x00000000055bf271 clang::CodeGen::CodeGenModule::createOpenMPRuntime() (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x55bf271)
#11 0x00000000055fa9e7 clang::CodeGen::CodeGenModule::CodeGenModule(clang::ASTContext&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, clang::HeaderSearchOptions const&, clang::PreprocessorOptions const&, clang::CodeGenOptions const&, llvm::Module&, clang::DiagnosticsEngine&, clang::CoverageSourceInfo*) (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x55fa9e7)
#12 0x00000000059a5092 (anonymous namespace)::CodeGeneratorImpl::Initialize(clang::ASTContext&) ModuleBuilder.cpp:0:0
#13 0x000000000599922d clang::BackendConsumer::Initialize(clang::ASTContext&) (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x599922d)
#14 0x0000000005cd383f clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x5cd383f)
#15 0x0000000005c54ec6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x5c54ec6)
#16 0x0000000005d9e573 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x5d9e573)
#17 0x0000000001719578 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x1719578)
#18 0x000000000171045a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#19 0x00000000017147fe clang_main(int, char**, llvm::ToolContext const&) (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x17147fe)
#20 0x00000000016833b3 main (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x16833b3)
#21 0x00007faafba2a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#22 0x00007faafba2a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#23 0x000000000170fe05 _start (/cefs/7a/7a3bbcbe5e0b18a207a84c9e_clang-assertions-trunk-20261024/bin/clang-24+0x170fe05)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed with exit code -2 (use -v to see invocation)
Program terminated with signal SIGABRT (6)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to