Closed martong closed 6 years ago
#0 0x00007fffedf52428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007fffedf5402a in __GI_abort () at abort.c:89
#2 0x00007fffedf4abd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7fffea96c9d0 "Result && \"Could not evaluate expression\"", file=file@entry=0x7fffea96c9fa "../../git/llvm/tools/clang/lib/AST/ExprConstant.cpp", line=line@entry=10185, function=function@entry=0x7fffea96ca2e "llvm::APSInt clang::Expr::EvaluateKnownConstInt(const clang::ASTContext &, SmallVectorImpl<PartialDiagnosticAt> *) const") at assert.c:92
#3 0x00007fffedf4ac82 in __GI___assert_fail (assertion=0x7fffea96c9d0 "Result && \"Could not evaluate expression\"", file=0x7fffea96c9fa "../../git/llvm/tools/clang/lib/AST/ExprConstant.cpp", line=10185, function=0x7fffea96ca2e "llvm::APSInt clang::Expr::EvaluateKnownConstInt(const clang::ASTContext &, SmallVectorImpl<PartialDiagnosticAt> *) const") at assert.c:101
#4 0x00007fffea675f7b in clang::Expr::EvaluateKnownConstInt (this=0x281a1d0, Ctx=..., Diag=0x0) at ../../git/llvm/tools/clang/lib/AST/ExprConstant.cpp:10185
#5 0x00007fffe3862ab8 in clang::ento::ExprEngine::processSwitch (this=0x7fffffff7210, builder=...) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:2134
#6 0x00007fffe383b206 in clang::ento::CoreEngine::HandleBlockExit (this=0x7fffffff7230, B=0x9b37cc0, Pred=0x8bc5000) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:465
#7 0x00007fffe383aa9e in clang::ento::CoreEngine::HandlePostStmt (this=0x7fffffff7230, B=0x9b37cc0, StmtIdx=7, Pred=0x8bc5000) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:528
#8 0x00007fffe383a406 in clang::ento::CoreEngine::dispatchWorkItem (this=0x7fffffff7230, Pred=0x8bc5000, Loc=..., WU=...) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:279
#9 0x00007fffe3839f68 in clang::ento::CoreEngine::ExecuteWorkList (this=0x7fffffff7230, L=0x5192ea0, Steps=224766, InitState=...) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:235
#10 0x00007fffe5553925 in clang::ento::ExprEngine::ExecuteWorkList (this=0x7fffffff7210, L=0x5192ea0, Steps=225000) at ../../git/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h:114
#11 0x00007fffe54f41eb in (anonymous namespace)::AnalysisConsumer::ActionExprEngine (this=0x6b3210, D=0x22d8110, ObjCGCEnabled=false, IMode=clang::ento::ExprEngine::Inline_Regular, VisitedCallees=0x7fffffff78c8) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:720
#12 0x00007fffe54f3f81 in (anonymous namespace)::AnalysisConsumer::RunPathSensitiveChecks (this=0x6b3210, D=0x22d8110, IMode=clang::ento::ExprEngine::Inline_Regular, Visited=0x7fffffff78c8) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:741
#13 0x00007fffe54f3c35 in (anonymous namespace)::AnalysisConsumer::HandleCode (this=0x6b3210, D=0x22d8110, Mode=2, IMode=clang::ento::ExprEngine::Inline_Regular, VisitedCallees=0x7fffffff78c8) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:687
#14 0x00007fffe54e723e in (anonymous namespace)::AnalysisConsumer::HandleDeclsCallGraph (this=0x6b3210, LocalTUDeclsSize=1701) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:500
#15 0x00007fffe54e54ad in (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit (this=0x6b3210, C=...) at ../../git/llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:552
#16 0x00007fffe8705de6 in clang::ParseAST (S=..., PrintStats=false, SkipFunctionBodies=false) at ../../git/llvm/tools/clang/lib/Parse/ParseAST.cpp:159
#17 0x00007fffef06829c in clang::ASTFrontendAction::ExecuteAction (this=0x692310) at ../../git/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:998
#18 0x00007fffef067d10 in clang::FrontendAction::Execute (this=0x692310) at ../../git/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:897
#19 0x00007fffeefdcf1a in clang::CompilerInstance::ExecuteAction (this=0x6712e0, Act=...) at ../../git/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:991
#20 0x00007fffeeba3ce6 in clang::ExecuteCompilerInvocation (Clang=0x6712e0) at ../../git/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:252
#21 0x0000000000425649 in cc1_main (Argv=llvm::ArrayRef of length 315 = {...}, Argv0=0x7fffffffb735 "/home/egbomrt/WORK/llvm2/build/debug/bin/clang-6.0", MainAddr=0x415d70 <GetExecutablePath[abi:cxx11](char const*, bool)>) at ../../git/llvm/tools/clang/tools/driver/cc1_main.cpp:221
#22 0x0000000000418189 in ExecuteCC1Tool (argv=llvm::ArrayRef of length 317 = {...}, Tool="") at ../../git/llvm/tools/clang/tools/driver/driver.cpp:309
#23 0x0000000000416e8d in main (argc_=317, argv_=0x7fffffffa8d8) at ../../git/llvm/tools/clang/tools/driver/driver.cpp:388
The init expression of a VarDecl is overwritten in the "To" context if we import a VarDecl without an init expression (and with a definition). This causes that the constant expression evaluation logic (clang::Expr::EvaluateKnownConstInt) asserts, because it searches for the missing initializer. Related: #477
Occurs in protobuf CTU.