[llvm-bugs] [Bug 37270] New: Assertion `InitVal.getAs<nonloc::LazyCompoundVal>()' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 27 07:29:56 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37270

            Bug ID: 37270
           Summary: Assertion `InitVal.getAs<nonloc::LazyCompoundVal>()'
                    failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: compile-fail, regression
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: v.reichelt at netcologne.de
                CC: llvm-bugs at lists.llvm.org

The following valid C++ code snippet triggers an assertion in the analyzer
of the LLVM trunk when compiled with "--analyze -std=c++17":

====================
struct A
{
  A(int) {}
};

void foo()
{
  A a = A(0);
}
====================

clang-7:
/tmp/LLVM/llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp:600: void
clang::ento::ExprEngine::VisitDeclStmt(const clang::DeclStmt*,
clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&): Assertion
`InitVal.getAs<nonloc::LazyCompoundVal>()' failed.
Stack dump:
1.      <eof> parser at end of file
2.      While analyzing stack: 
        #0 Calling foo
3.      bug.cc:13:3: Error evaluating statement
4.      bug.cc:13:3: Error evaluating statement
#0 0x000000000213e02a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/LLVM/bin/clang-7+0x213e02a)
#1 0x000000000213bd66 llvm::sys::RunSignalHandlers()
(/LLVM/bin/clang-7+0x213bd66)
#2 0x000000000213c0d5 SignalHandler(int) (/LLVM/bin/clang-7+0x213c0d5)
#3 0x00007fe555d8a100 __restore_rt (/lib64/libpthread.so.0+0xf100)
#4 0x00007fe5549075f7 __GI_raise (/lib64/libc.so.6+0x355f7)
#5 0x00007fe554908ce8 __GI_abort (/lib64/libc.so.6+0x36ce8)
#6 0x00007fe554900566 __assert_fail_base (/lib64/libc.so.6+0x2e566)
#7 0x00007fe554900612 (/lib64/libc.so.6+0x2e612)
#8 0x00000000032d2e7c clang::ento::ExprEngine::VisitDeclStmt(clang::DeclStmt
const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&)
(/LLVM/bin/clang-7+0x32d2e7c)
#9 0x00000000032c61e7 clang::ento::ExprEngine::Visit(clang::Stmt const*,
clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&)
(/LLVM/bin/clang-7+0x32c61e7)
#10 0x00000000032cb1f4 clang::ento::ExprEngine::ProcessStmt(clang::Stmt const*,
clang::ento::ExplodedNode*) (/LLVM/bin/clang-7+0x32cb1f4)
#11 0x00000000032cb392
clang::ento::ExprEngine::processCFGElement(clang::CFGElement,
clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*)
(/LLVM/bin/clang-7+0x32cb392)
#12 0x00000000032973a7 clang::ento::CoreEngine::HandlePostStmt(clang::CFGBlock
const*, unsigned int, clang::ento::ExplodedNode*) (/LLVM/bin/clang-7+0x32973a7)
#13 0x00000000032975d7
clang::ento::CoreEngine::dispatchWorkItem(clang::ento::ExplodedNode*,
clang::ProgramPoint, clang::ento::WorkListUnit const&)
(/LLVM/bin/clang-7+0x32975d7)
#14 0x000000000329784c
clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*,
unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>)
(/LLVM/bin/clang-7+0x329784c)
#15 0x0000000002f9e754 (anonymous
namespace)::AnalysisConsumer::ActionExprEngine(clang::Decl*, bool,
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*,
llvm::DenseMapInfo<clang::Decl const*> >*) (.part.4641)
(/LLVM/bin/clang-7+0x2f9e754)
#16 0x0000000002f9ef4b (anonymous
namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int,
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*,
llvm::DenseMapInfo<clang::Decl const*> >*) (/LLVM/bin/clang-7+0x2f9ef4b)
#17 0x0000000002fb138a (anonymous
namespace)::AnalysisConsumer::runAnalysisOnTranslationUnit(clang::ASTContext&)
(/LLVM/bin/clang-7+0x2fb138a)
#18 0x0000000002fb211b (anonymous
namespace)::AnalysisConsumer::HandleTranslationUnit(clang::ASTContext&)
(/LLVM/bin/clang-7+0x2fb211b)
#19 0x000000000339f9f9 clang::ParseAST(clang::Sema&, bool, bool)
(/LLVM/bin/clang-7+0x339f9f9)
#20 0x000000000276d39e clang::FrontendAction::Execute()
(/LLVM/bin/clang-7+0x276d39e)
#21 0x000000000273465e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/LLVM/bin/clang-7+0x273465e)
#22 0x000000000281705b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/LLVM/bin/clang-7+0x281705b)
#23 0x00000000008a9fc8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/LLVM/bin/clang-7+0x8a9fc8)
#24 0x000000000082aa15 main (/LLVM/bin/clang-7+0x82aa15)
#25 0x00007fe5548f3b15 __libc_start_main (/lib64/libc.so.6+0x21b15)
#26 0x00000000008a72e9 _start (/LLVM/bin/clang-7+0x8a72e9)
clang-7: error: unable to execute command: Aborted (core dumped)
clang-7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /LLVM/bin

This happens with trunk (since at least r330183, but probably also older
versions), but not with the 6.0.0 release.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180427/390886a6/attachment.html>


More information about the llvm-bugs mailing list