<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115490>115490</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-20 crashed with no_caller_saved_registers attribute. Assertion `At && "Received null Attr object!"' failed.
</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>
clang-20 crashed with ```no_caller_saved_registers``` attribute .
Compiler explorer: https://godbolt.org/z/bKoP3zT4j
```
$cat mutant.c
int a();
int __attribute__((no_caller_saved_registers)) b();
__typeof(b) a;
Reduced by Creduce.
Also crashed on clang-19.
$clang-19 mutant.c
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 -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=/home/code/reduce -fcoverage-compilation-dir=/home/code/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/11/../../../../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-bb858a.o -x c mutant.c
1. mutant.c:3:14: current parser token ';'
#0 0x00007fa81efce246 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea7246)
#1 0x00007fa81efcbe20 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea4e20)
#2 0x00007fa81efce90b (/usr/lib/llvm-19/bin/../lib/libLLVM.so.19.0+0xea790b)
#3 0x00007fa81dc06520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007fa826b720d1 clang::Attr::getSpelling() const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xeb90d1)
#5 0x00007fa826a299c8 clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind, long, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long>>, llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xd709c8)
#6 0x00007fa826766752 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xaad752)
#7 0x00007fa8289cf44c clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2d1644c)
#8 0x00007fa82676c3f4 clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xab33f4)
#9 0x00007fa8267660b2 clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xaad0b2)
#10 0x00007fa82722080e clang::Sema::EmitCurrentDiagnostic(unsigned int) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x156780e)
#11 0x00007fa8272abfb9 clang::SemaBase::ImmediateDiagBuilder::~ImmediateDiagBuilder() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x15f2fb9)
#12 0x00007fa82722133b clang::SemaBase::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x156833b)
#13 0x00007fa8273b01c8 clang::Sema::MergeFunctionDecl(clang::FunctionDecl*, clang::NamedDecl*&, clang::Scope*, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x16f71c8)
#14 0x00007fa8273cc8c3 clang::Sema::CheckFunctionDeclaration(clang::Scope*, clang::FunctionDecl*, clang::LookupResult&, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x17138c3)
#15 0x00007fa8273bf8eb clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x17068eb)
#16 0x00007fa8273bb438 clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1702438)
#17 0x00007fa8273ba918 clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x1701918)
#18 0x00007fa826901390 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc48390)
#19 0x00007fa8268ff0e6 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+0xc460e6)
#20 0x00007fa8269bd987 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xd04987)
#21 0x00007fa8269bd33b clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xd0433b)
#22 0x00007fa8269bc547 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xd03547)
#23 0x00007fa8269baa27 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xd01a27)
#24 0x00007fa8268e87de clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0xc2f7de)
#25 0x00007fa82897b0b5 clang::FrontendAction::Execute() (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2cc20b5)
#26 0x00007fa8288eb2f4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2c322f4)
#27 0x00007fa8289f7dee clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-19/bin/../lib/libclang-cpp.so.19.0+0x2d3edee)
#28 0x0000560b7f6f1bc5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/lib/llvm-19/bin/clang+0x11bc5)
#29 0x0000560b7f6eead5 (/usr/lib/llvm-19/bin/clang+0xead5)
#30 0x0000560b7f6edc9b clang_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm-19/bin/clang+0xdc9b)
#31 0x0000560b7f6fbf36 main (/usr/lib/llvm-19/bin/clang+0x1bf36)
#32 0x00007fa81dbedd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#33 0x00007fa81dbede40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#34 0x0000560b7f6ec765 _start (/usr/lib/llvm-19/bin/clang+0xc765)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Ubuntu clang version 19.0.0 (++20240722031324+65825cd5431c-1~exp1~20240722151445.1819)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
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-c62a1c.c
clang: note: diagnostic msg: /tmp/mutant-c62a1c.sh
clang: note: diagnostic msg:
********************
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8WktT4zjX_jVmo1LKlh1fFiwCId3U0NMUYWaWKVk6Npq2JX-yTMMs5rd_Jdu5yAQaetIvRUEiyUfPeXRukkXbVpQS4NybX3jz5RntzIPS54LWVCr5XKuuZe1ZrvjzOauoLDHxEdO0fQCOvgvzgLzYH36l2jBaVaA3LX0EvtFQitaAbncjEDVGi7wzgGaev_T8xfD3UtWNqEAjeGoqpUF74QI9GNO0XrjwyMojq1LxXFVmpnTpkdU_Hlnlv6nb8J_76O9DSbupxq8kYtSgujNUmhkbGoU0iHok9UjmhRf7ts1mB2-z6fvT11UimUcylE_EbDbmuQFVeCTNbT_d9Qx_74B3DDjKn9Gl7j-PPCyqVu1oVRINVAeZQ5PVZmyfqHR7c7VYX6G2y2thEEV5VyINjdIGGTVlUpiHLp8xVXtkVVWP23-40epvYMYjK9G2HbQ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