-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
Assertion failure with if consteval
+ -Wconsumed
#117385
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Comments
@davidstone thanks for the report. I'll take a look. @AaronBallman should I proceed with a revert for now? |
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
Nov 22, 2024
@llvm/issue-subscribers-clang-frontend Author: David Stone (davidstone)
The following valid translation unit:
void f() {
if consteval {
}
} when compiled with clang++: /root/llvm-project/llvm/include/llvm/Support/Casting.h:662: decltype(auto) llvm::dyn_cast(From*) [with To = clang::ExprWithCleanups; From = const clang::Expr]: Assertion `detail::isPresent(Val) && "dyn_cast on a non-existent value"' 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 -std=c++23 -Wconsumed <source>
1. <eof> parser at end of file
2. <source>:1:10: parsing function body 'f'
#<!-- -->0 0x0000000003bfabd8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bfabd8)
#<!-- -->1 0x0000000003bf88dc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3bf88dc)
#<!-- -->2 0x0000000003b45fc8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#<!-- -->3 0x00007e7b14e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#<!-- -->4 0x00007e7b14e969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#<!-- -->5 0x00007e7b14e42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#<!-- -->6 0x00007e7b14e287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#<!-- -->7 0x00007e7b14e2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#<!-- -->8 0x00007e7b14e39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#<!-- -->9 0x00000000071bfed4 clang::consumed::ConsumedStmtVisitor::getInfo(clang::Expr const*) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71bfed4)
#<!-- -->10 0x00000000071c5327 clang::consumed::ConsumedAnalyzer::splitState(clang::CFGBlock const*, clang::consumed::ConsumedStmtVisitor const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71c5327)
#<!-- -->11 0x00000000071ca1be clang::consumed::ConsumedAnalyzer::run(clang::AnalysisDeclContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x71ca1be)
#<!-- -->12 0x0000000007132088 clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy, clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x7132088)
#<!-- -->13 0x000000000669a286 clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy const*, clang::Decl const*, clang::QualType) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x669a286)
#<!-- -->14 0x00000000068b72f0 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x68b72f0)
#<!-- -->15 0x000000000661e68f clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x661e68f)
#<!-- -->16 0x0000000006531f03 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6531f03)
#<!-- -->17 0x00000000065666bd 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+++0x65666bd)
#<!-- -->18 0x0000000006525c4e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6525c4e)
#<!-- -->19 0x000000000652640e clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x652640e)
#<!-- -->20 0x000000000652dba3 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x652dba3)
#<!-- -->21 0x000000000652ea8d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x652ea8d)
#<!-- -->22 0x000000000652ef30 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x652ef30)
#<!-- -->23 0x0000000006520f72 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6520f72)
#<!-- -->24 0x000000000457dcb8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x457dcb8)
#<!-- -->25 0x00000000048383a9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48383a9)
#<!-- -->26 0x00000000047b82be clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x47b82be)
#<!-- -->27 0x000000000492333e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x492333e)
#<!-- -->28 0x0000000000caa161 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xcaa161)
#<!-- -->29 0x0000000000ca1cea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#<!-- -->30 0x00000000045c0eb9 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 0x0000000003b46474 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3b46474)
#<!-- -->32 0x00000000045c14af 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 0x000000000458779d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x458779d)
#<!-- -->34 0x000000000458888d 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+++0x458888d)
#<!-- -->35 0x000000000458fc45 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x458fc45)
#<!-- -->36 0x0000000000ca6f93 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xca6f93)
#<!-- -->37 0x0000000000b7da84 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xb7da84)
#<!-- -->38 0x00007e7b14e29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->39 0x00007e7b14e29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->40 0x0000000000ca179e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xca179e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134 See it live: https://godbolt.org/z/643oYTrqh This was introduced by fe697ef @a-tarasyuk @AaronBallman |
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]
The following valid translation unit:
when compiled with
-std=c++23 -Wconsumed
causes clang to fail withSee it live: https://godbolt.org/z/643oYTrqh
This was introduced by fe697ef @a-tarasyuk @AaronBallman
The text was updated successfully, but these errors were encountered: