Skip to content

Clang errors out after parsing out a typeid of and indexed parameter pack. #93650

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
AhmedLilah opened this issue May 29, 2024 · 6 comments · Fixed by #94299
Closed

Clang errors out after parsing out a typeid of and indexed parameter pack. #93650

AhmedLilah opened this issue May 29, 2024 · 6 comments · Fixed by #94299
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] good first issue https://github.com/llvm/llvm-project/contribute

Comments

@AhmedLilah
Copy link

Version: x86-64Trunk
Platform: www.godblot.org

Source

#include <print>

auto function(auto ... inputArgs) {
    return typeid(inputArgs...[0]).name();
}


auto main() -> int {
    std::println("{}", function(5, 5.0, "char", 'c'));
    return 0;
}

Crash backtrace

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/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++26 -stdlib=libc++ -O3 <source>
1.	<source>:4:35: current parser token '.'
2.	<source>:3:35: parsing function body 'function'
3.	<source>:3:35: in compound statement ('{}')
 #0 0x0000000003742eb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3742eb8)
 #1 0x0000000003741004 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3741004)
 #2 0x000000000368caf8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007098b0442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00000000070ecb10 clang::Expr::HasSideEffects(clang::ASTContext const&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x70ecb10)
 #5 0x0000000006575ffb clang::Sema::BuildCXXTypeId(clang::QualType, clang::SourceLocation, clang::Expr*, clang::SourceLocation) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6575ffb)
 #6 0x000000000659f984 clang::Sema::ActOnCXXTypeid(clang::SourceLocation, clang::SourceLocation, bool, void*, clang::SourceLocation) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x659f984)
 #7 0x0000000005f53aff clang::Parser::ParseCXXTypeid() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f53aff)
 #8 0x0000000005f418e1 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f418e1)
 #9 0x0000000005f4424a clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f4424a)
#10 0x0000000005f44409 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f44409)
#11 0x0000000005f49789 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f49789)
#12 0x0000000005fc4d4d clang::Parser::ParseReturnStatement() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fc4d4d)
#13 0x0000000005fc902e clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fc902e)
#14 0x0000000005fca377 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fca377)
#15 0x0000000005fcb1b1 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fcb1b1)
#16 0x0000000005fcd71a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fcd71a)
#17 0x0000000005ecabbb clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ecabbb)
#18 0x0000000005f1221e clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f1221e)
#19 0x0000000005ec4be7 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ec4be7)
#20 0x0000000005ec5ad3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ec5ad3)
#21 0x0000000005ece15a clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ece15a)
#22 0x0000000005ecff47 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ecff47)
#23 0x0000000005ebf09a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ebf09a)
#24 0x0000000003fc577d clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fc577d)
#25 0x0000000004267c31 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4267c31)
#26 0x00000000041eb1cb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41eb1cb)
#27 0x000000000434e9d3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x434e9d3)
#28 0x0000000000c5bd9c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5bd9c)
#29 0x0000000000c55c8d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#30 0x000000000400ea89 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 0x000000000368cf13 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x368cf13)
#32 0x000000000400eca9 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 0x0000000003fd4925 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fd4925)
#34 0x0000000003fd52fd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fd52fd)
#35 0x0000000003fdf21c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fdf21c)
#36 0x0000000000c59191 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc59191)
#37 0x0000000000b3a8a4 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb3a8a4)
#38 0x00007098b0429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#39 0x00007098b0429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#40 0x0000000000c5572e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5572e)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139
@github-actions github-actions bot added the clang Clang issues not falling into any other category label May 29, 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 clang Clang issues not falling into any other category labels May 29, 2024
@llvmbot
Copy link
Member

llvmbot commented May 29, 2024

@llvm/issue-subscribers-clang-frontend

Author: Ahmed S. Lilah (AhmedLilah)

Version: x86-64Trunk Platform: www.godblot.org

Source

#include &lt;print&gt;

auto function(auto ... inputArgs) {
    return typeid(inputArgs...[0]).name();
}


auto main() -&gt; int {
    std::println("{}", function(5, 5.0, "char", 'c'));
    return 0;
}

Crash backtrace

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/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++26 -stdlib=libc++ -O3 &lt;source&gt;
1.	&lt;source&gt;:4:35: current parser token '.'
2.	&lt;source&gt;:3:35: parsing function body 'function'
3.	&lt;source&gt;:3:35: in compound statement ('{}')
 #<!-- -->0 0x0000000003742eb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3742eb8)
 #<!-- -->1 0x0000000003741004 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3741004)
 #<!-- -->2 0x000000000368caf8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #<!-- -->3 0x00007098b0442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x00000000070ecb10 clang::Expr::HasSideEffects(clang::ASTContext const&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x70ecb10)
 #<!-- -->5 0x0000000006575ffb clang::Sema::BuildCXXTypeId(clang::QualType, clang::SourceLocation, clang::Expr*, clang::SourceLocation) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6575ffb)
 #<!-- -->6 0x000000000659f984 clang::Sema::ActOnCXXTypeid(clang::SourceLocation, clang::SourceLocation, bool, void*, clang::SourceLocation) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x659f984)
 #<!-- -->7 0x0000000005f53aff clang::Parser::ParseCXXTypeid() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f53aff)
 #<!-- -->8 0x0000000005f418e1 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f418e1)
 #<!-- -->9 0x0000000005f4424a clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f4424a)
#<!-- -->10 0x0000000005f44409 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f44409)
#<!-- -->11 0x0000000005f49789 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f49789)
#<!-- -->12 0x0000000005fc4d4d clang::Parser::ParseReturnStatement() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fc4d4d)
#<!-- -->13 0x0000000005fc902e 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/bin/clang+++0x5fc902e)
#<!-- -->14 0x0000000005fca377 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fca377)
#<!-- -->15 0x0000000005fcb1b1 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fcb1b1)
#<!-- -->16 0x0000000005fcd71a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fcd71a)
#<!-- -->17 0x0000000005ecabbb clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ecabbb)
#<!-- -->18 0x0000000005f1221e 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/bin/clang+++0x5f1221e)
#<!-- -->19 0x0000000005ec4be7 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec&amp;, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ec4be7)
#<!-- -->20 0x0000000005ec5ad3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ec5ad3)
#<!-- -->21 0x0000000005ece15a clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ece15a)
#<!-- -->22 0x0000000005ecff47 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ecff47)
#<!-- -->23 0x0000000005ebf09a clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ebf09a)
#<!-- -->24 0x0000000003fc577d clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fc577d)
#<!-- -->25 0x0000000004267c31 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4267c31)
#<!-- -->26 0x00000000041eb1cb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41eb1cb)
#<!-- -->27 0x000000000434e9d3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x434e9d3)
#<!-- -->28 0x0000000000c5bd9c cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5bd9c)
#<!-- -->29 0x0000000000c55c8d ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) driver.cpp:0:0
#<!-- -->30 0x000000000400ea89 void llvm::function_ref&lt;void ()&gt;::callback_fn&lt;clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const::'lambda'()&gt;(long) Job.cpp:0:0
#<!-- -->31 0x000000000368cf13 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x368cf13)
#<!-- -->32 0x000000000400eca9 clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (.part.0) Job.cpp:0:0
#<!-- -->33 0x0000000003fd4925 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fd4925)
#<!-- -->34 0x0000000003fd52fd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fd52fd)
#<!-- -->35 0x0000000003fdf21c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fdf21c)
#<!-- -->36 0x0000000000c59191 clang_main(int, char**, llvm::ToolContext const&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc59191)
#<!-- -->37 0x0000000000b3a8a4 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb3a8a4)
#<!-- -->38 0x00007098b0429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->39 0x00007098b0429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->40 0x0000000000c5572e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5572e)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139

@cor3ntin
Copy link
Contributor

In HasSideEffects we should always return false for PackIndexingExpr (because the selected expression it always an id expression), that way we don't have to try to recurse in a selected expression we might not have.

@cor3ntin cor3ntin added the good first issue https://github.com/llvm/llvm-project/contribute label May 29, 2024
@llvmbot
Copy link
Member

llvmbot commented May 29, 2024

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Check that no other contributor has already been assigned to this issue. If you believe that no one is actually working on it despite an assignment, ping the person. After one week without a response, the assignee may be changed.
  2. In the comments of this issue, request for it to be assigned to you, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
  3. Fix the issue locally.
  4. Run the test suite locally. Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  5. Create a Git commit.
  6. Run git clang-format HEAD~1 to format your changes.
  7. Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.

If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.

@llvmbot
Copy link
Member

llvmbot commented May 29, 2024

@llvm/issue-subscribers-good-first-issue

Author: Ahmed S. Lilah (AhmedLilah)

Version: x86-64Trunk Platform: www.godblot.org

Source

#include &lt;print&gt;

auto function(auto ... inputArgs) {
    return typeid(inputArgs...[0]).name();
}


auto main() -&gt; int {
    std::println("{}", function(5, 5.0, "char", 'c'));
    return 0;
}

Crash backtrace

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/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++26 -stdlib=libc++ -O3 &lt;source&gt;
1.	&lt;source&gt;:4:35: current parser token '.'
2.	&lt;source&gt;:3:35: parsing function body 'function'
3.	&lt;source&gt;:3:35: in compound statement ('{}')
 #<!-- -->0 0x0000000003742eb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3742eb8)
 #<!-- -->1 0x0000000003741004 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3741004)
 #<!-- -->2 0x000000000368caf8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #<!-- -->3 0x00007098b0442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x00000000070ecb10 clang::Expr::HasSideEffects(clang::ASTContext const&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x70ecb10)
 #<!-- -->5 0x0000000006575ffb clang::Sema::BuildCXXTypeId(clang::QualType, clang::SourceLocation, clang::Expr*, clang::SourceLocation) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x6575ffb)
 #<!-- -->6 0x000000000659f984 clang::Sema::ActOnCXXTypeid(clang::SourceLocation, clang::SourceLocation, bool, void*, clang::SourceLocation) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x659f984)
 #<!-- -->7 0x0000000005f53aff clang::Parser::ParseCXXTypeid() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f53aff)
 #<!-- -->8 0x0000000005f418e1 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f418e1)
 #<!-- -->9 0x0000000005f4424a clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f4424a)
#<!-- -->10 0x0000000005f44409 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f44409)
#<!-- -->11 0x0000000005f49789 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5f49789)
#<!-- -->12 0x0000000005fc4d4d clang::Parser::ParseReturnStatement() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fc4d4d)
#<!-- -->13 0x0000000005fc902e 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/bin/clang+++0x5fc902e)
#<!-- -->14 0x0000000005fca377 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fca377)
#<!-- -->15 0x0000000005fcb1b1 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fcb1b1)
#<!-- -->16 0x0000000005fcd71a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5fcd71a)
#<!-- -->17 0x0000000005ecabbb clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ecabbb)
#<!-- -->18 0x0000000005f1221e 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/bin/clang+++0x5f1221e)
#<!-- -->19 0x0000000005ec4be7 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec&amp;, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ec4be7)
#<!-- -->20 0x0000000005ec5ad3 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ec5ad3)
#<!-- -->21 0x0000000005ece15a clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ece15a)
#<!-- -->22 0x0000000005ecff47 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ecff47)
#<!-- -->23 0x0000000005ebf09a clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x5ebf09a)
#<!-- -->24 0x0000000003fc577d clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fc577d)
#<!-- -->25 0x0000000004267c31 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4267c31)
#<!-- -->26 0x00000000041eb1cb clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x41eb1cb)
#<!-- -->27 0x000000000434e9d3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x434e9d3)
#<!-- -->28 0x0000000000c5bd9c cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5bd9c)
#<!-- -->29 0x0000000000c55c8d ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) driver.cpp:0:0
#<!-- -->30 0x000000000400ea89 void llvm::function_ref&lt;void ()&gt;::callback_fn&lt;clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const::'lambda'()&gt;(long) Job.cpp:0:0
#<!-- -->31 0x000000000368cf13 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x368cf13)
#<!-- -->32 0x000000000400eca9 clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (.part.0) Job.cpp:0:0
#<!-- -->33 0x0000000003fd4925 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fd4925)
#<!-- -->34 0x0000000003fd52fd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fd52fd)
#<!-- -->35 0x0000000003fdf21c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3fdf21c)
#<!-- -->36 0x0000000000c59191 clang_main(int, char**, llvm::ToolContext const&amp;) (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc59191)
#<!-- -->37 0x0000000000b3a8a4 main (/opt/compiler-explorer/clang-trunk/bin/clang+++0xb3a8a4)
#<!-- -->38 0x00007098b0429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->39 0x00007098b0429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->40 0x0000000000c5572e _start (/opt/compiler-explorer/clang-trunk/bin/clang+++0xc5572e)
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Compiler returned: 139

@AhmedLilah
Copy link
Author

Hi there,

I want to start contributing to the project.

Can you give me a heads up on how to start and how to get started fixing this bug?

And how do I get it assigned to me?

@Endilll
Copy link
Contributor

Endilll commented May 30, 2024

You should check out our documentation: https://clang.llvm.org/get_started.html
Then you should reproduce the crash locally.
After that you can navigate to

case PackIndexingExprClass:
return cast<PackIndexingExpr>(this)->getSelectedExpr()->HasSideEffects(
Ctx, IncludePossibleEffects);
, apply Corentin's suggestion and see if it helps.

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] good first issue https://github.com/llvm/llvm-project/contribute
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants