<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95892>95892</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-19 crashed with the attribute `opencl_global_device`: /root/llvm-project/clang/include/clang/AST/Type.h:956: const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const: Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
iamanonymouscs
</td>
</tr>
</table>
<pre>
Clang-19 with the attribute `opencl_global_device` enabled.
Compiler explorer(assertion trunck): https://godbolt.org/z/WKGesoejq
```
$cat mutant.c
a(;
__attribute__((opencl_global_device )) * b() {
return a
$clang-19 mutant.c
mutant.c:1:3: error: expected parameter declarator
1 | a(;
| ^
mutant.c:1:3: error: expected ')'
mutant.c:1:2: note: to match this '('
1 | a(;
| ^
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:51: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
2 | __attribute__((opencl_global_device )) * b() {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
| int
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: /usr/lib/llvm-19/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -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 /usr/lib/llvm-19/lib/clang/19 -internal-isystem /usr/lib/llvm-19/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 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/mutant-78f8d7.o -x c mutant.c
1. <eof> parser at end of file
2. mutant.c:2:55: parsing function body 'b'
3. mutant.c:2:55: in compound statement ('{}')
#0 0x00007f7145e43216 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xdc1216)
#1 0x00007f7145e40ec0 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xdbeec0)
#2 0x00007f7145e438f0 (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xdc18f0)
#3 0x00007f7150832980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#4 0x00007f714df331e4 clang::Sema::DiagnoseAssignmentResult(clang::Sema::AssignConvertType, clang::SourceLocation, clang::QualType, clang::QualType, clang::Expr*, clang::Sema::AssignmentAction, bool*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x17581e4)
#5 0x00007f714e0cf550 clang::InitializationSequence::Perform(clang::Sema&, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x18f4550)
#6 0x00007f714e0d634b clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&, clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x18fb34b)
#7 0x00007f714e22c9bf clang::Sema::PerformMoveOrCopyInitialization(clang::InitializedEntity const&, clang::Sema::NamedReturnInfo const&, clang::Expr*, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1a519bf)
#8 0x00007f714e22ecf3 clang::Sema::BuildReturnStmt(clang::SourceLocation, clang::Expr*, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1a53cf3)
#9 0x00007f714e22e2d1 clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*, clang::Scope*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1a532d1)
#10 0x00007f714d439e90 clang::Parser::ParseReturnStatement() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc5ee90)
#11 0x00007f714d433f49 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc58f49)
#12 0x00007f714d4332cb clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc582cb)
#13 0x00007f714d43bc80 clang::Parser::ParseCompoundStatementBody(bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc60c80)
#14 0x00007f714d43cdef clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc61def)
#15 0x00007f714d456c36 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc7bc36)
#16 0x00007f714d3a13a7 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xbc63a7)
#17 0x00007f714d455cb4 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc7acb4)
#18 0x00007f714d45569b clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc7a69b)
#19 0x00007f714d4548ed clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc798ed)
#20 0x00007f714d452d3c clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc77d3c)
#21 0x00007f714d38b11e clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xbb011e)
#22 0x00007f714f288825 clang::FrontendAction::Execute() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2aad825)
#23 0x00007f714f2040d4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2a290d4)
#24 0x00007f714f301f7e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2b26f7e)
#25 0x0000556391993fad cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-19/bin/clang+0x12fad)
#26 0x0000556391991075 (/usr/lib/llvm-19/bin/clang+0x10075)
#27 0x0000556391990213 clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-19/bin/clang+0xf213)
#28 0x000055639199e556 main (/usr/lib/llvm-19/bin/clang+0x1d556)
#29 0x00007f714427cc87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#30 0x000055639198dbfa _start (/usr/lib/llvm-19/bin/clang+0xcbfa)
clang-19: error: unable to execute command: Segmentation fault (core dumped)
clang-19: error: clang frontend command failed due to signal (use -v to see invocation)
Ubuntu clang version 19.0.0 (++20240301064251+dd426fa5f931-1~exp1~20240301184412.1845)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
clang-19: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-19: note: diagnostic msg: /tmp/mutant-c932d2.c
clang-19: note: diagnostic msg: /tmp/mutant-c932d2.sh
clang-19: note: diagnostic msg:
********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWl9T67a2_zTmReOMLf9_4CEkZJd72IUDtJ25LxlZWg7qtiVXkimch372O5KdEJuQDbvpncMwYMuS1lo_rX-SFtGabwTAuZdceMnyjHTmUapzThoipHhpZKepPislezlf1ERs_LBAf3LziMwjIGKM4mVnAHlpIFsQtF5valmSes3giVPw0gCBIGUNbOYFSy-Y938Xsml5DQrBc1tLBcrDOdEalOFSIKM6Qb95uPCiOXo0ptVeNPfwysOrjWSlrM1Mqo2HV__x8Oq3f30BLeH3P4b502D47V9xTIlBTWeIMDPaNxIP51500b-s1zsp1mv7AeeHJEGWHVwgD89R6boVyMuGORSYTglE9kW0lLeAjcnv3qJ56EXzyEo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