[llvm-bugs] [Bug 28031] New: clang crashes on valid C++ code with -std=c++11 or -std=c++14: Assertion `isLambdaCallOperator(Frame->Callee) && (VD->getDeclContext() != Frame->Callee || VD->isInitCapture()) && "missing value for local variable"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 6 20:52:29 PDT 2016


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

            Bug ID: 28031
           Summary: clang crashes on valid C++ code with -std=c++11 or
                    -std=c++14: Assertion
                    `isLambdaCallOperator(Frame->Callee) &&
                    (VD->getDeclContext() != Frame->Callee ||
                    VD->isInitCapture()) && "missing value for local
                    variable"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following valid C++ test
case with -std=c++11 or -std=c++14 on x86_64-linux-gnu in both 32-bit and
64-bit modes. 

It compiles fine with -std=c++98 and -std=c++03. 

This is a regression from 3.8.x. 


$ clang++ -v
clang version 3.9.0 (trunk 271877)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++ -c small.cpp
$ clang++-3.8 -c -std=c++11 small.cpp
$
$ g++-6.1 -c -std=c++11 small.cpp
$
$ clang++ -c -std=c++11 small.cpp
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/AST/ExprConstant.cpp:2116:
bool evaluateVarDeclInit({anonymous}::EvalInfo&, const clang::Expr*, const
clang::VarDecl*, {anonymous}::CallStackFrame*, clang::APValue*&): Assertion
`isLambdaCallOperator(Frame->Callee) && (VD->getDeclContext() != Frame->Callee
|| VD->isInitCapture()) && "missing value for local variable"' failed.
#0 0x0000000001e1a4f5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1e1a4f5)
#1 0x0000000001e18486 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1e18486)
#2 0x0000000001e186a4 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1e186a4)
#3 0x00007f0d02556340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f0d01774cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f0d017780d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f0d0176db86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f0d0176dc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000003402f13 evaluateVarDeclInit((anonymous namespace)::EvalInfo&,
clang::Expr const*, clang::VarDecl const*, (anonymous
namespace)::CallStackFrame*, clang::APValue*&)
(/usr/local/clang-trunk/bin/clang-3.9+0x3402f13)
#9 0x000000000340338e findCompleteObject((anonymous namespace)::EvalInfo&,
clang::Expr const*, AccessKinds, (anonymous namespace)::LValue const&,
clang::QualType) (/usr/local/clang-trunk/bin/clang-3.9+0x340338e)
#10 0x000000000341ab7d handleLValueToRValueConversion((anonymous
namespace)::EvalInfo&, clang::Expr const*, clang::QualType, (anonymous
namespace)::LValue const&, clang::APValue&)
(/usr/local/clang-trunk/bin/clang-3.9+0x341ab7d)
#11 0x000000000342061a (anonymous
namespace)::IntExprEvaluator::VisitCastExpr(clang::CastExpr const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x342061a)
#12 0x00000000034217ff clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x34217ff)
#13 0x00000000034231ce EvaluateInteger(clang::Expr const*, llvm::APSInt&,
(anonymous namespace)::EvalInfo&)
(/usr/local/clang-trunk/bin/clang-3.9+0x34231ce)
#14 0x0000000003411166 clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::LValueExprEvaluator, bool>::Visit(clang::Stmt const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x3411166)
#15 0x00000000034119a4 EvaluateLValue(clang::Expr const*, (anonymous
namespace)::LValue&, (anonymous namespace)::EvalInfo&)
(/usr/local/clang-trunk/bin/clang-3.9+0x34119a4)
#16 0x00000000034193a0 Evaluate(clang::APValue&, (anonymous
namespace)::EvalInfo&, clang::Expr const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x34193a0)
#17 0x000000000341a157 EvaluateArgs(llvm::ArrayRef<clang::Expr const*>,
llvm::SmallVector<clang::APValue, 8u>&, (anonymous namespace)::EvalInfo&)
(/usr/local/clang-trunk/bin/clang-3.9+0x341a157)
#18 0x0000000003424825 HandleConstructorCall(clang::SourceLocation, (anonymous
namespace)::LValue const&, llvm::ArrayRef<clang::Expr const*>,
clang::CXXConstructorDecl const*, (anonymous namespace)::EvalInfo&,
clang::APValue&) (/usr/local/clang-trunk/bin/clang-3.9+0x3424825)
#19 0x0000000003425cee (anonymous
namespace)::RecordExprEvaluator::VisitCXXConstructExpr(clang::CXXConstructExpr
const*, clang::QualType) (/usr/local/clang-trunk/bin/clang-3.9+0x3425cee)
#20 0x00000000034184fa clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::RecordExprEvaluator, bool>::Visit(clang::Stmt const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x34184fa)
#21 0x00000000034192cb EvaluateRecord(clang::Expr const*, (anonymous
namespace)::LValue const&, clang::APValue&, (anonymous namespace)::EvalInfo&)
(/usr/local/clang-trunk/bin/clang-3.9+0x34192cb)
#22 0x00000000034256d8 HandleConstructorCall(clang::SourceLocation, (anonymous
namespace)::LValue const&, llvm::ArrayRef<clang::Expr const*>,
clang::CXXConstructorDecl const*, (anonymous namespace)::EvalInfo&,
clang::APValue&) (/usr/local/clang-trunk/bin/clang-3.9+0x34256d8)
#23 0x0000000003425cee (anonymous
namespace)::RecordExprEvaluator::VisitCXXConstructExpr(clang::CXXConstructExpr
const*, clang::QualType) (/usr/local/clang-trunk/bin/clang-3.9+0x3425cee)
#24 0x00000000034184fa clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::RecordExprEvaluator, bool>::Visit(clang::Stmt const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x34184fa)
#25 0x00000000034192cb EvaluateRecord(clang::Expr const*, (anonymous
namespace)::LValue const&, clang::APValue&, (anonymous namespace)::EvalInfo&)
(/usr/local/clang-trunk/bin/clang-3.9+0x34192cb)
#26 0x000000000343f427 clang::Expr::EvaluateAsInitializer(clang::APValue&,
clang::ASTContext const&, clang::VarDecl const*,
llvm::SmallVectorImpl<std::pair<clang::SourceLocation,
clang::PartialDiagnostic> >&) const
(/usr/local/clang-trunk/bin/clang-3.9+0x343f427)
#27 0x000000000339fc94
clang::VarDecl::evaluateValue(llvm::SmallVectorImpl<std::pair<clang::SourceLocation,
clang::PartialDiagnostic> >&) const
(/usr/local/clang-trunk/bin/clang-3.9+0x339fc94)
#28 0x000000000339fe3d clang::VarDecl::evaluateValue() const
(/usr/local/clang-trunk/bin/clang-3.9+0x339fe3d)
#29 0x0000000001f8cd9c
clang::CodeGen::CodeGenModule::EmitConstantInit(clang::VarDecl const&,
clang::CodeGen::CodeGenFunction*)
(/usr/local/clang-trunk/bin/clang-3.9+0x1f8cd9c)
#30 0x0000000001ff08b6
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*,
bool) (/usr/local/clang-trunk/bin/clang-3.9+0x1ff08b6)
#31 0x0000000002007fd1
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-3.9+0x2007fd1)
#32 0x0000000002009079
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/usr/local/clang-trunk/bin/clang-3.9+0x2009079)
#33 0x000000000200964d
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone
.part.6208] (/usr/local/clang-trunk/bin/clang-3.9+0x200964d)
#34 0x00000000025c703b (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/clang-trunk/bin/clang-3.9+0x25c703b)
#35 0x00000000025c194c
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/clang-trunk/bin/clang-3.9+0x25c194c)
#36 0x0000000002923676 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2923676)
#37 0x00000000025c23fe clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x25c23fe)
#38 0x000000000228f1fe clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x228f1fe)
#39 0x0000000002264c66
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2264c66)
#40 0x000000000231c362
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x231c362)
#41 0x0000000000aecce8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xaecce8)
#42 0x0000000000aa14de main (/usr/local/clang-trunk/bin/clang-3.9+0xaa14de)
#43 0x00007f0d0175fec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#44 0x0000000000ae8d54 _start (/usr/local/clang-trunk/bin/clang-3.9+0xae8d54)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.cpp -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
-coverage-file /data2/small.cpp -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 252
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp
1.      <eof> parser at end of file
2.      small.cpp:9:3: LLVM IR generation of declaration 'b'
3.      small.cpp:9:6: Generating code for declaration 'b2'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 271877)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/small-4d0a52.cpp
clang-3.9: note: diagnostic msg: /tmp/small-4d0a52.sh
clang-3.9: note: diagnostic msg:

********************
$


------------------------------


struct A {};

struct B
{ 
  virtual void f ();
  A a[2];
};

B b, b2 (b);

-- 
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/20160607/4c040f06/attachment.html>


More information about the llvm-bugs mailing list