<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/112743>112743</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang++] Assertion `(Kind != CK_LValueToRValue || !(T->isNullPtrType() || T->getAsCXXRecordDecl())) && "invalid type for lvalue-to-rvalue conversion"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
crash-on-invalid,
clang:frontend:fuzzer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
yijan4845
</td>
</tr>
</table>
<pre>
**This testcase is generated by a fuzzer.**
Compiler Explorer: [https://godbolt.org/z/PTP1M3jfT](https://godbolt.org/z/PTP1M3jfT)
This invalid code will crash on Clang Assertion Trunk, it seems that this goes back to clang-12:
```cpp
struct A {};
A a;
int x;
[[clang::annotate("jui", &x, a, &x, "abc")]] void t3() {}
```
Stack dump:
```
clang++: /root/llvm-project/clang/lib/AST/Expr.cpp:2084: static clang::ImplicitCastExpr* clang::ImplicitCastExpr::Create(const clang::ASTContext&, clang::QualType, clang::CastKind, clang::Expr*, const CXXCastPath*, clang::ExprValueKind, clang::FPOptionsOverride): Assertion `(Kind != CK_LValueToRValue || !(T->isNullPtrType() || T->getAsCXXRecordDecl())) && "invalid type for lvalue-to-rvalue conversion"' 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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O3 <source>
1. <source>:4:56: current parser token '{'
#0 0x0000000003bb4fc8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bb4fc8)
#1 0x0000000003bb2c8c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bb2c8c)
#2 0x0000000003b00278 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000079b341642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000079b3416969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000079b341642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000079b3416287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000079b34162871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000079b341639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000007aed649 clang::ImplicitCastExpr::Create(clang::ASTContext const&, clang::QualType, clang::CastKind, clang::Expr*, llvm::SmallVector<clang::CXXBaseSpecifier*, 4u> const*, clang::ExprValueKind, clang::FPOptionsOverride) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7aed649)
#10 0x000000000685ff80 clang::Sema::ConstantFoldAttrArgs(clang::AttributeCommonInfo const&, llvm::MutableArrayRef<clang::Expr*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x685ff80)
#11 0x00000000067e8fa2 clang::Sema::CreateAnnotationAttr(clang::ParsedAttr const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x67e8fa2)
#12 0x0000000006aa5138 ProcessDeclAttribute(clang::Sema&, clang::Scope*, clang::Decl*, clang::ParsedAttr const&, clang::Sema::ProcessDeclAttributeOptions const&) (.isra.0) SemaDeclAttr.cpp:0:0
#13 0x0000000006aa73d3 clang::Sema::ProcessDeclAttributes(clang::Scope*, clang::Decl*, clang::Declarator const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6aa73d3)
#14 0x0000000006a3ccbc clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a3ccbc)
#15 0x0000000006a436d0 clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a436d0)
#16 0x0000000006a44080 clang::Sema::ActOnStartOfFunctionDef(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::SkipBodyInfo*, clang::Sema::FnBodyKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6a44080)
#17 0x000000000667ffe0 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x667ffe0)
#18 0x00000000066b4f4d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66b4f4d)
#19 0x00000000066745de clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66745de)
#20 0x0000000006674d9e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6674d9e)
#21 0x000000000667c533 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x667c533)
#22 0x000000000667d41d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x667d41d)
#23 0x000000000666f93a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x666f93a)
#24 0x0000000004529838 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4529838)
#25 0x00000000047e3f89 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47e3f89)
#26 0x0000000004762a7e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4762a7e)
#27 0x00000000048c972e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48c972e)
#28 0x0000000000cdd9cf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcdd9cf)
#29 0x0000000000cd56da ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#30 0x000000000456d549 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#31 0x0000000003b00724 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b00724)
#32 0x000000000456db3f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#33 0x000000000453343d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x453343d)
#34 0x000000000453452d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x453452d)
#35 0x000000000453be55 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x453be55)
#36 0x0000000000cda89f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcda89f)
#37 0x0000000000ba9b24 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xba9b24)
#38 0x000079b341629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#39 0x000079b341629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#40 0x0000000000cd518e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcd518e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
ASM generation compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWk1z2zjS_jX0BUUVCX4ffKBla97MOK-9kWsqNxUIgjJiCuACoCPn128BoCyCkjzxjpWt2p3yRBI-Gk8_3ehuEkBS0jUj5NJLrrzk-gL16pGLyxf6DbE4j5OLitcvlx4sPVg-PFIJFJEKI0kAlWBNGBFIkRpULwCBpv_xg4iZHewF114w_Dvnm462RICbbddyQYQXlcBLrh6V6qQXlR5ceHCx5nXFWzXjYu3BxQ8PLu4f7sPP0bfmwUuuPZj__HBYjJc3uCl7Ri2tAeY1Ad9p2wIskHwEnIF5i9galFISoShn4EH07MmDc0AVkIRsJFCPSAGlxaw5kaBC-AkoDrCe6IdQY7LrpYH9w11nW6QSPVagBF525WXXXnRl20uAXr9TpsD29ZcxxJURre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