<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96383>96383</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-19 crashed: Assertion `isa<X>(Val) && "cast_if_present<Ty>() argument of incompatible type!"' failed. with `#pragma omp declare simd`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
iamanonymouscs
</td>
</tr>
</table>
<pre>
Compiler explorer(assertion trunck): https://godbolt.org/z/nMEbj11jr
```
$cat mutant.c
a;
b() {
#pragma omp tile sizes(8)
for (a = 0; a < 2; a = a + 3)
;
}
$clang-19 -fsanitize=undefined -fopenmp-simd mutant.c
mutant.c:1:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
1 | a;
| ^
| int
mutant.c:2:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
2 | b() {
| ^
| int
clang-19: /root/new_git/llvm-project/llvm/include/llvm/Support/Casting.h:706: auto llvm::cast_if_present(Y *) [X = clang::CapturedStmt, Y = const clang::Stmt]: Assertion `isa<X>(Val) && "cast_if_present<Ty>() argument of incompatible type!"' failed.
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: /root/llvm_set/7500646/bin/clang-19 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -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 x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/code/my_code/diff_coverage/combine_test/case_reduce -fcoverage-compilation-dir=/root/code/my_code/diff_coverage/combine_test/case_reduce -resource-dir /root/llvm_set/7500646/lib/clang/19 -internal-isystem /root/llvm_set/7500646/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -ferror-limit 19 -fopenmp-simd -fsanitize=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr -fsanitize-recover=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,vptr -fno-sanitize-memory-param-retval -fno-sanitize-address-use-odr-indicator -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/mutant-f05ab7.o -x c mutant.c
1. <eof> parser at end of file
2. mutant.c:2:1: LLVM IR generation of declaration 'b'
3. mutant.c:2:1: Generating code for declaration 'b'
#0 0x00007f15e9d25e37 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/root/llvm_set/7500646/bin/../lib/libLLVM.so.19.0git+0xfade37)
#1 0x00007f15e9d221a2 llvm::sys::RunSignalHandlers() (/root/llvm_set/7500646/bin/../lib/libLLVM.so.19.0git+0xfaa1a2)
#2 0x00007f15e9d265e9 SignalHandler(int) Signals.cpp:0:0
#3 0x00007f1616db0980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#4 0x00007f15e7f8fe87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007f15e7f917f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007f15e7f813fa __assert_fail_base /build/glibc-CVJwZb/glibc-2.27/assert/assert.c:89:0
#7 0x00007f15e7f81472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472)
#8 0x00007f16072e13bb (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3dc73bb)
#9 0x00007f16072d8b54 (anonymous namespace)::OMPSimdLexicalScope::OMPSimdLexicalScope(clang::CodeGen::CodeGenFunction&, clang::OMPExecutableDirective const&) CGStmtOpenMP.cpp:0:0
#10 0x00007f16072d7659 clang::CodeGen::CodeGenFunction::EmitSimpleOMPExecutableDirective(clang::OMPExecutableDirective const&) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3dbd659)
#11 0x00007f16072623ae clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3d483ae)
#12 0x00007f1607279653 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3d5f653)
#13 0x00007f160734dda8 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3e33da8)
#14 0x00007f160734f768 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3e35768)
#15 0x00007f1607396884 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3e7c884)
#16 0x00007f1607389127 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3e6f127)
#17 0x00007f1607390205 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3e76205)
#18 0x00007f160738771f clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3e6d71f)
#19 0x00007f1607500ac4 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#20 0x00007f160732715c clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x3e0d15c)
#21 0x00007f160439812b clang::ParseAST(clang::Sema&, bool, bool) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0xe7e12b)
#22 0x00007f1608c13495 clang::FrontendAction::Execute() (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x56f9495)
#23 0x00007f1608ac83cb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x55ae3cb)
#24 0x00007f1608d14116 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/root/llvm_set/7500646/bin/../lib/libclang-cpp.so.19.0git+0x57fa116)
#25 0x000055c9c9aadc19 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/root/llvm_set/7500646/bin/clang-19+0x1bc19)
#26 0x000055c9c9aa3a65 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x000055c9c9aa2409 clang_main(int, char**, llvm::ToolContext const&) (/root/llvm_set/7500646/bin/clang-19+0x10409)
#28 0x000055c9c9ac8785 main (/root/llvm_set/7500646/bin/clang-19+0x36785)
#29 0x00007f15e7f72c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#30 0x000055c9c9a9f6fa _start (/root/llvm_set/7500646/bin/clang-19+0xd6fa)
clang: error: unable to execute command: Aborted (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 75006466296ed4b0f845cbbec4bf77c21de43b40)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /root/llvm_set/7500646/bin
Build config: +assertions
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-63a760.c
clang: note: diagnostic msg: /tmp/mutant-63a760.sh
clang: note: diagnostic msg:
********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUWl1z3Ciz_jXkhmJKQt8XvhhrPNmcSk5csU_2fc_NFILWmI0EKkCOvb_-FGi-NHGytjeps28qthGC7n4emqYBMWvlVgFcoOwSZas3bHR32lxI1jOl1WOvR8vtm0aLx4ta94PswGB4GDptwCBaMmvBOKkVdmZU_AuiFUqW-M65waJkiega0fVWi0Z3bqHNFtH1n4iu1Yer5o84_sOgaIWiJcqj3f_pkaacOdyPjim34FMlQ8nlVGoQLRGtMCou9-2TwbBtz7DuB-xkB9jKP8EiWvqGUyOMW22wNxmjZIUjlFxiX6wx3RdX_je9xMmx00EpKla7wsHEjqktiStMWsuUdPJPQMlqVAJaqUBg0uoBVD8QK3txBubwlCzj3Q8GY7TxBfc4ALYDcNlKMLiX1kq1RbTGAlo2ds5ipzGihVQO0cJb_-7mI66rCjMlcMccGCw0VtphOw6DNg7Lfugklw5L5TDKLsnv-xripWSrPUkYxxgVNT7SjcM_X4eyq_Mq3_kcEf2nIaLB1G_c5nnA9sPscSC6Nlo778DwdbOVvtR19z0ZjP4D-P4R0bVUvBsFHCtuJrMRXdfMOqm2izuULIso93LZ6DQODZMlSpacWbeR7WYwYMEzUv4bI7oMxmeX_wqeGsyamtdscKMBceN65zn999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