-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partycrash-on-invalidgenerated by fuzzer
Description
This testcase is generated by a fuzzer.
Compiler Explorer: https://godbolt.org/z/5T1EYWxcv
This invalid code will crash on Clang Assertion Trunk. It seems that this goes back to clang-11:
struct S {
static const int sdm = sdm = 42;
};
extern S *s;
constexpr int e4 = s->sdm;Stack dump:
clang++: /root/llvm-project/clang/lib/AST/ExprConstant.cpp:3079: bool evaluateVarDeclInit({anonymous}::EvalInfo&, const clang::Expr*, const clang::VarDecl*, {anonymous}::CallStackFrame*, clang::APValue*&, const {anonymous}::LValue*): Assertion `!VD->mightBeUsableInConstantExpressions(Info.Ctx)' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-11.0.0/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-10.2.0 -fcolor-diagnostics -fno-crash-diagnostics -O3 <source>
1. <source>:5:26: current parser token ';'
#0 0x00005942a8e23f7e llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x31d6f7e)
#1 0x00005942a8e21d54 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x31d4d54)
#2 0x00005942a8e21fd1 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x31d4fd1)
#3 0x00005942a8d8d9b8 CrashRecoverySignalHandler(int) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x31409b8)
#4 0x00007f5383a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#5 0x00007f5383a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#6 0x00007f5383a42476 raise (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#7 0x00007f5383a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#8 0x00007f5383a2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#9 0x00007f5383a39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x00005942aba82f02 (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5e35f02)
#11 0x00005942aba838da findCompleteObject((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::AccessKinds, (anonymous namespace)::LValue const&, clang::QualType) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5e368da)
#12 0x00005942abaa68d7 handleLValueToRValueConversion((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::QualType, (anonymous namespace)::LValue const&, clang::APValue&, bool) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5e598d7)
#13 0x00005942abadb0e5 (anonymous namespace)::IntExprEvaluator::VisitCastExpr(clang::CastExpr const*) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5e8e0e5)
#14 0x00005942abaadc3e clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5e60c3e)
#15 0x00005942aba9cf9e Evaluate(clang::APValue&, (anonymous namespace)::EvalInfo&, clang::Expr const*) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5e4ff9e)
#16 0x00005942abab53e2 EvaluateInPlace(clang::APValue&, (anonymous namespace)::EvalInfo&, (anonymous namespace)::LValue const&, clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5e683e2)
#17 0x00005942ababff34 clang::Expr::EvaluateAsInitializer(clang::APValue&, clang::ASTContext const&, clang::VarDecl const*, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >&) const (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5e72f34)
#18 0x00005942ab9cac6a clang::VarDecl::evaluateValue(llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >&) const (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5d7dc6a)
#19 0x00005942aafb5f5a clang::Sema::CheckCompleteVariableDeclaration(clang::VarDecl*) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5368f5a)
#20 0x00005942aafb7634 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x536a634)
#21 0x00005942aad686eb clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x511b6eb)
#22 0x00005942aad7b9ec clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x512e9ec)
#23 0x00005942aad52576 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5105576)
#24 0x00005942aad52c11 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.0) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x5105c11)
#25 0x00005942aad572a7 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (.localalias) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x510a2a7)
#26 0x00005942aad57c78 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x510ac78)
#27 0x00005942aad4c9e9 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x50ff9e9)
#28 0x00005942a9dddd38 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x4190d38)
#29 0x00005942a970ae79 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x3abde79)
#30 0x00005942a96c1846 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x3a74846)
#31 0x00005942a97df790 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x3b92790)
#32 0x00005942a6b92c5c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0xf45c5c)
#33 0x00005942a6b8fd98 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0xf42d98)
#34 0x00005942a9581219 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x3934219)
#35 0x00005942a8d8db3c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x3140b3c)
#36 0x00005942a9581b36 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (.part.0) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x3934b36)
#37 0x00005942a955910c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x390c10c)
#38 0x00005942a9559a46 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x390ca46)
#39 0x00005942a9562d49 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0x3915d49)
#40 0x00005942a6adc599 main (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0xe8f599)
#41 0x00007f5383a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#42 0x00007f5383a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#43 0x00005942a6b8f8ee _start (/opt/compiler-explorer/clang-assertions-11.0.0/bin/clang+++0xf428ee)
clang-11: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 254
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partycrash-on-invalidgenerated by fuzzer