Skip to content

Front-end crashes when __PRETTY_FUNCTION__ (or __FUNCSIG__) appears in trailing return type #121274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jhcarl0814 opened this issue Dec 28, 2024 · 1 comment · Fixed by #122611
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] lambda C++11 lambda expressions

Comments

@jhcarl0814
Copy link

jhcarl0814 commented Dec 28, 2024

On Compiler Explorer clang crashes when __PRETTY_FUNCTION__ appears in trailing return type. On my computer clang-cl.exe crashes when __FUNCSIG__ appears in trailing return type.

Compiler Explorer, x64-64 clang (trunk), -std=c++26 -O2 -Wall -pedantic -pthread:

int main()
{
    []() -> decltype(static_cast<char const*>(__PRETTY_FUNCTION__)) { return nullptr; };
}

Could not execute the program
Build failed
Compiler returned: 254
Compiler stderr

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-trunk-20241228/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name example.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-trunk-20241228/lib/clang/20 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/x86_64-linux-gnu -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/backward -internal-isystem /opt/compiler-explorer/clang-trunk-20241228/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.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 -O2 -Wall -pedantic -std=c++26 -fdeprecated-macro -ferror-limit 19 -pthread -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-b47b85.o -x c++ <source>
1.	<source>:4:47: current parser token '__PRETTY_FUNCTION__'
2.	<source>:3:1: parsing function body 'main'
3.	<source>:3:1: in compound statement ('{}')
4.	<source>:4:5: lambda expression parsing
 #0 0x0000000003a32498 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x3a32498)
 #1 0x0000000003a3005c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007eaa64842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00000000073767a4 clang::PredefinedExpr::ComputeName[abi:cxx11](clang::PredefinedIdentKind, clang::Decl const*, bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x73767a4)
 #4 0x00000000067639bf clang::Sema::BuildPredefinedExpr(clang::SourceLocation, clang::PredefinedIdentKind) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x67639bf)
 #5 0x00000000062ef620 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62ef620)
 #6 0x00000000062f10ca clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f10ca)
 #7 0x00000000062f1299 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f1299)
 #8 0x00000000062f6539 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f6539)
 #9 0x000000000630ab32 clang::Parser::ParseCXXCasts() (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x630ab32)
#10 0x00000000062ef70e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62ef70e)
#11 0x00000000062f10ca clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f10ca)
#12 0x00000000062f1299 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f1299)
#13 0x00000000062f6539 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f6539)
#14 0x00000000062d1cf6 clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62d1cf6)
#15 0x000000000630d037 clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool, clang::IdentifierInfo const**, bool, bool, bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x630d037)
#16 0x000000000626d522 clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x626d522)
#17 0x00000000062b24c4 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62b24c4)
#18 0x00000000062b3832 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62b3832)
#19 0x00000000062b3cef clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62b3cef)
#20 0x00000000063128bc clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x63128bc)
#21 0x0000000006312e0b clang::Parser::ParseLambdaExpression() (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6312e0b)
#22 0x00000000062f0805 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f0805)
#23 0x00000000062f10ca clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f10ca)
#24 0x00000000062f1299 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f1299)
#25 0x00000000062f6539 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f6539)
#26 0x00000000063833c7 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x63833c7)
#27 0x0000000006376b57 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6376b57)
#28 0x000000000637754d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x637754d)
#29 0x0000000006378864 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6378864)
#30 0x0000000006379a1a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6379a1a)
#31 0x0000000006275c56 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6275c56)
#32 0x00000000062bfbdf clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62bfbdf)
#33 0x000000000626e207 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x626e207)
#34 0x000000000626f01e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x626f01e)
#35 0x0000000006278932 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6278932)
#36 0x000000000627a1c8 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x627a1c8)
#37 0x000000000627a710 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x627a710)
#38 0x0000000006268833 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6268833)
#39 0x000000000436e385 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x436e385)
#40 0x000000000463a081 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x463a081)
#41 0x00000000045b9fcb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x45b9fcb)
#42 0x00000000047240b3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x47240b3)
#43 0x0000000000d01daa cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0xd01daa)
#44 0x0000000000cfa5fd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#45 0x0000000000cfd3cf clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0xcfd3cf)
#46 0x0000000000bc6874 main (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0xbc6874)
#47 0x00007eaa64829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#48 0x00007eaa64829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#49 0x0000000000cfa095 _start (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0xcfa095)
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
@jhcarl0814 jhcarl0814 changed the title Front-end crashes when __PRETTY_FUNCTION__ (or __FUNCSIG__) appears in trailing return type Front-end crashes when __PRETTY_FUNCTION__ (or __FUNCSIG__) appears in trailing return type Dec 28, 2024
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Dec 28, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 28, 2024

@llvm/issue-subscribers-clang-frontend

Author: Han Jiang (jhcarl0814)

On Compiler Explorer `clang` crashes when `__PRETTY_FUNCTION__` appears in trailing return type. On my computer `clangcl.exe` crashes when `__FUNCSIG__` appears in trailing return type.

Compiler Explorer, x64-64 clang (trunk), -std=c++26 -O2 -Wall -pedantic -pthread:

int main()
{
    []() -&gt; decltype(static_cast&lt;char const*&gt;(__PRETTY_FUNCTION__)) { return nullptr; };
}

Could not execute the program
Build failed
Compiler returned: 254
Compiler stderr

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-trunk-20241228/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name example.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-trunk-20241228/lib/clang/20 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0 -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/x86_64-linux-gnu -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../include/c++/15.0.0/backward -internal-isystem /opt/compiler-explorer/clang-trunk-20241228/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.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 -O2 -Wall -pedantic -std=c++26 -fdeprecated-macro -ferror-limit 19 -pthread -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-b47b85.o -x c++ &lt;source&gt;
1.	&lt;source&gt;:4:47: current parser token '__PRETTY_FUNCTION__'
2.	&lt;source&gt;:3:1: parsing function body 'main'
3.	&lt;source&gt;:3:1: in compound statement ('{}')
4.	&lt;source&gt;:4:5: lambda expression parsing
 #<!-- -->0 0x0000000003a32498 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x3a32498)
 #<!-- -->1 0x0000000003a3005c SignalHandler(int) Signals.cpp:0:0
 #<!-- -->2 0x00007eaa64842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->3 0x00000000073767a4 clang::PredefinedExpr::ComputeName[abi:cxx11](clang::PredefinedIdentKind, clang::Decl const*, bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x73767a4)
 #<!-- -->4 0x00000000067639bf clang::Sema::BuildPredefinedExpr(clang::SourceLocation, clang::PredefinedIdentKind) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x67639bf)
 #<!-- -->5 0x00000000062ef620 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62ef620)
 #<!-- -->6 0x00000000062f10ca clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f10ca)
 #<!-- -->7 0x00000000062f1299 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f1299)
 #<!-- -->8 0x00000000062f6539 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f6539)
 #<!-- -->9 0x000000000630ab32 clang::Parser::ParseCXXCasts() (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x630ab32)
#<!-- -->10 0x00000000062ef70e clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62ef70e)
#<!-- -->11 0x00000000062f10ca clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f10ca)
#<!-- -->12 0x00000000062f1299 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f1299)
#<!-- -->13 0x00000000062f6539 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f6539)
#<!-- -->14 0x00000000062d1cf6 clang::Parser::ParseDecltypeSpecifier(clang::DeclSpec&amp;) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62d1cf6)
#<!-- -->15 0x000000000630d037 clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&amp;, clang::OpaquePtr&lt;clang::QualType&gt;, bool, bool, bool*, bool, clang::IdentifierInfo const**, bool, bool, bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x630d037)
#<!-- -->16 0x000000000626d522 clang::Parser::TryAnnotateCXXScopeToken(bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x626d522)
#<!-- -->17 0x00000000062b24c4 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&amp;, clang::Parser::ParsedTemplateInfo&amp;, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62b24c4)
#<!-- -->18 0x00000000062b3832 clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&amp;, clang::ImplicitTypenameContext, clang::AccessSpecifier, clang::Parser::DeclSpecContext) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62b3832)
#<!-- -->19 0x00000000062b3cef clang::Parser::ParseTypeName(clang::SourceRange*, clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**, clang::ParsedAttributes*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62b3cef)
#<!-- -->20 0x00000000063128bc clang::Parser::ParseLambdaExpressionAfterIntroducer(clang::LambdaIntroducer&amp;) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x63128bc)
#<!-- -->21 0x0000000006312e0b clang::Parser::ParseLambdaExpression() (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6312e0b)
#<!-- -->22 0x00000000062f0805 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f0805)
#<!-- -->23 0x00000000062f10ca clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f10ca)
#<!-- -->24 0x00000000062f1299 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f1299)
#<!-- -->25 0x00000000062f6539 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62f6539)
#<!-- -->26 0x00000000063833c7 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x63833c7)
#<!-- -->27 0x0000000006376b57 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6376b57)
#<!-- -->28 0x000000000637754d clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x637754d)
#<!-- -->29 0x0000000006378864 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6378864)
#<!-- -->30 0x0000000006379a1a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&amp;) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6379a1a)
#<!-- -->31 0x0000000006275c56 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6275c56)
#<!-- -->32 0x00000000062bfbdf clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&amp;, clang::DeclaratorContext, clang::ParsedAttributes&amp;, clang::Parser::ParsedTemplateInfo&amp;, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x62bfbdf)
#<!-- -->33 0x000000000626e207 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec&amp;, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x626e207)
#<!-- -->34 0x000000000626f01e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x626f01e)
#<!-- -->35 0x0000000006278932 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6278932)
#<!-- -->36 0x000000000627a1c8 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x627a1c8)
#<!-- -->37 0x000000000627a710 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x627a710)
#<!-- -->38 0x0000000006268833 clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x6268833)
#<!-- -->39 0x000000000436e385 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x436e385)
#<!-- -->40 0x000000000463a081 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x463a081)
#<!-- -->41 0x00000000045b9fcb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x45b9fcb)
#<!-- -->42 0x00000000047240b3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0x47240b3)
#<!-- -->43 0x0000000000d01daa cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0xd01daa)
#<!-- -->44 0x0000000000cfa5fd ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) driver.cpp:0:0
#<!-- -->45 0x0000000000cfd3cf clang_main(int, char**, llvm::ToolContext const&amp;) (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0xcfd3cf)
#<!-- -->46 0x0000000000bc6874 main (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0xbc6874)
#<!-- -->47 0x00007eaa64829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->48 0x00007eaa64829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->49 0x0000000000cfa095 _start (/opt/compiler-explorer/clang-trunk-20241228/bin/clang-20+0xcfa095)
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)

@zyn0217 zyn0217 added the lambda C++11 lambda expressions label Dec 29, 2024
cor3ntin pushed a commit that referenced this issue Jan 12, 2025
…cl) appears in the trailing return type of the lambda (#122611)

The (function) type of the lambda function is null while parsing
trailing return type. The type is filled-in when the lambda body is
entered. So, resolving `__PRETTY_FUNCTION__` before the lambda body is
entered causes the crash.

Fixes #121274.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] lambda C++11 lambda expressions
Projects
None yet
4 participants