[llvm-bugs] [Bug 41134] New: Analyzer crash in C++17 mode

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 19 03:03:45 PDT 2019


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

            Bug ID: 41134
           Summary: Analyzer crash in C++17 mode
           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: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

The following valid testcase triggers an assertion when compiled with
"--analyze -std=c++17":

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

A get()
{
  return { A() };
}

void foo(A&&);

void bar()
{
  foo(get());
}
=======================

clang-9: llvm/tools/clang/lib/StaticAnalyzer/Core/RegionStore.cpp:2362:
{anonymous}::RegionBindingsRef
{anonymous}::RegionStoreManager::bindStruct(RegionBindingsConstRef, const
clang::ento::TypedValueRegion*, clang::ento::SVal): Assertion
`CRD->isAggregate() && "Non-aggregates are constructed with a constructor!"'
failed.
Stack dump:
0.      Program arguments: LLVM/LLVM-trunk-356359/bin/clang-9 -cc1 -triple
x86_64-unknown-linux-gnu -analyze -disable-free -main-file-name CLbug.cc
-analyzer-store=region -analyzer-opt-analyze-nested-blocks
-analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix
-analyzer-checker=deadcode -analyzer-checker=cplusplus
-analyzer-checker=security.insecureAPI.UncheckedReturn
-analyzer-checker=security.insecureAPI.getpw
-analyzer-checker=security.insecureAPI.gets
-analyzer-checker=security.insecureAPI.mktemp
-analyzer-checker=security.insecureAPI.mkstemp
-analyzer-checker=security.insecureAPI.vfork
-analyzer-checker=nullability.NullPassedToNonnull
-analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir
LLVM/LLVM-trunk-356359/lib/clang/9.0.0 -internal-isystem
/opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/../../../../include/c++/5.3.1
-internal-isystem
/opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/../../../../include/c++/5.3.1/x86_64-redhat-linux
-internal-isystem
/opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/../../../../include/c++/5.3.1/backward
-internal-isystem /usr/local/include -internal-isystem
LLVM/LLVM-trunk-356359/lib/clang/9.0.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -std=c++17 -fdeprecated-macro
-fdebug-compilation-dir /home/vreichelt -ferror-limit 19 -fmessage-length 0
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
CLbug.plist -x c++ CLbug.cc -faddrsig 
1.      <eof> parser at end of file
2.      While analyzing stack: 
        #0 Calling bar
3.      CLbug.cc:21:7: Error evaluating statement
4.      CLbug.cc:21:7: Error evaluating statement
 #0 0x000000000244a19a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x244a19a)
 ...
 #9 0x00000000039c1233 (anonymous
namespace)::RegionStoreManager::bind((anonymous namespace)::RegionBindingsRef
const&, clang::ento::Loc, clang::ento::SVal)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x39c1233)
#10 0x00000000039c17d5 (anonymous namespace)::RegionStoreManager::Bind(void
const*, clang::ento::Loc, clang::ento::SVal)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x39c17d5)
#11 0x00000000039a742c clang::ento::ProgramState::bindLoc(clang::ento::Loc,
clang::ento::SVal, clang::LocationContext const*, bool) const
(LLVM/LLVM-trunk-356359/bin/clang-9+0x39a742c)
#12 0x00000000039383c5
clang::ento::ExprEngine::createTemporaryRegionIfNeeded(llvm::IntrusiveRefCntPtr<clang::ento::ProgramState
const>, clang::LocationContext const*, clang::Expr const*, clang::Expr const*,
clang::ento::SubRegion const**) (LLVM/LLVM-trunk-356359/bin/clang-9+0x39383c5)
#13 0x000000000395ab93
clang::ento::ExprEngine::CreateCXXTemporaryObject(clang::MaterializeTemporaryExpr
const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x395ab93)
#14 0x000000000394628e clang::ento::ExprEngine::Visit(clang::Stmt const*,
clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x394628e)
#15 0x0000000003947c72 clang::ento::ExprEngine::ProcessStmt(clang::Stmt const*,
clang::ento::ExplodedNode*) (LLVM/LLVM-trunk-356359/bin/clang-9+0x3947c72)
#16 0x0000000003947e2a
clang::ento::ExprEngine::processCFGElement(clang::CFGElement,
clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x3947e2a)
#17 0x000000000391aaa6 clang::ento::CoreEngine::HandlePostStmt(clang::CFGBlock
const*, unsigned int, clang::ento::ExplodedNode*)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x391aaa6)
#18 0x000000000391ad35
clang::ento::CoreEngine::dispatchWorkItem(clang::ento::ExplodedNode*,
clang::ProgramPoint, clang::ento::WorkListUnit const&) (.localalias.229)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x391ad35)
#19 0x000000000391ae32
clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*,
unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x391ae32)
#20 0x00000000035c2ad2 (anonymous
namespace)::AnalysisConsumer::HandleCode(clang::Decl*, unsigned int,
clang::ento::ExprEngine::InliningModes, llvm::DenseSet<clang::Decl const*,
llvm::DenseMapInfo<clang::Decl const*> >*)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x35c2ad2)
#21 0x00000000035db770 (anonymous
namespace)::AnalysisConsumer::runAnalysisOnTranslationUnit(clang::ASTContext&)
(LLVM/LLVM-trunk-356359/bin/clang-9+0x35db770)
 ...
clang version 9.0.0 (trunk)
Target: x86_64-unknown-linux-gnu
Thread model: posix

This is a regression that was introduced between r355810 and r356359.

-- 
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/20190319/53b4b4ca/attachment-0001.html>


More information about the llvm-bugs mailing list