[llvm-bugs] [Bug 28122] New: clang crashes on C++ code with invalid assignment to complex number: Assertion `getValueKind() == VK_LValue' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 13 23:49:06 PDT 2016


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

            Bug ID: 28122
           Summary: clang crashes on C++ code with invalid assignment to
                    complex number: Assertion `getValueKind() ==
                    VK_LValue' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following C++ test case on
x86_64-linux-gnu in both 32-bit and 64-bit modes. 

It seems to affect all clang versions since as early as 3.1. 


$ clang++ -v
clang version 3.9.0 (trunk 272539)
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.9:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/AST/ExprClassification.cpp:56:
Cl clang::Expr::ClassifyImpl(clang::ASTContext&, clang::SourceLocation*) const:
Assertion `getValueKind() == VK_LValue' failed.
#0 0x0000000001d1df05 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1d1df05)
#1 0x0000000001d1bd96 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1d1bd96)
#2 0x0000000001d1bfb4 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1d1bfb4)
#3 0x00007fdb62993340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fdb61bb1cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fdb61bb50d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fdb61baab86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fdb61baac32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x00000000032cd195 clang::Expr::ClassifyImpl(clang::ASTContext&,
clang::SourceLocation*) const (/usr/local/clang-trunk/bin/clang-3.9+0x32cd195)
#9 0x00000000032cd2a7 clang::Expr::isModifiableLvalue(clang::ASTContext&,
clang::SourceLocation*) const (/usr/local/clang-trunk/bin/clang-3.9+0x32cd2a7)
#10 0x0000000002b8eeec CheckForModifiableLvalue(clang::Expr*,
clang::SourceLocation, clang::Sema&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2b8eeec)
#11 0x0000000002ba931e clang::Sema::CheckAssignmentOperands(clang::Expr*,
clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation,
clang::QualType) (/usr/local/clang-trunk/bin/clang-3.9+0x2ba931e)
#12 0x0000000002baa557 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2baa557)
#13 0x0000000002bab18a clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2bab18a)
#14 0x0000000002bab4b1 clang::Sema::ActOnBinOp(clang::Scope*,
clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2bab4b1)
#15 0x0000000002829585
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level) (/usr/local/clang-trunk/bin/clang-3.9+0x2829585)
#16 0x0000000002828e89
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-3.9+0x2828e89)
#17 0x0000000002828ef9
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-3.9+0x2828ef9)
#18 0x0000000002869e56 clang::Parser::ParseExprStatement()
(/usr/local/clang-trunk/bin/clang-3.9+0x2869e56)
#19 0x000000000286736f
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x286736f)
#20 0x00000000028674de
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-3.9+0x28674de)
#21 0x000000000286bb59 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x286bb59)
#22 0x000000000286e461 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/local/clang-trunk/bin/clang-3.9+0x286e461)
#23 0x00000000027ed08e
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x27ed08e)
#24 0x000000000280cdbd clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-3.9+0x280cdbd)
#25 0x00000000027e8bcd
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x27e8bcd)
#26 0x00000000027e9271
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.222]
(/usr/local/clang-trunk/bin/clang-3.9+0x27e9271)
#27 0x00000000027e92af
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x27e92af)
#28 0x00000000027ee060
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-3.9+0x27ee060)
#29 0x00000000027ee830
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x27ee830)
#30 0x00000000027e5e50 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x27e5e50)
#31 0x0000000002481d8e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x2481d8e)
#32 0x000000000219458e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x219458e)
#33 0x0000000002169fe6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2169fe6)
#34 0x0000000002222392
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2222392)
#35 0x0000000000aefa88 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xaefa88)
#36 0x0000000000aa3c84 main (/usr/local/clang-trunk/bin/clang-3.9+0xaa3c84)
#37 0x00007fdb61b9cec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#38 0x0000000000aebaf4 _start (/usr/local/clang-trunk/bin/clang-3.9+0xaebaf4)
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 -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 171
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp
1.      small.cpp:4:19: current parser token ';'
2.      small.cpp:2:1: parsing function body 'foo'
3.      small.cpp:2:1: in compound statement ('{}')
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 272539)
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-9324ac.cpp
clang-3.9: note: diagnostic msg: /tmp/small-9324ac.sh
clang-3.9: note: diagnostic msg:

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


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


// should be: void foo (__complex__ double x)
void foo (double x) 
{ 
  __real__ x = 1.0;
  __imag__ x = 1.0;
}

-- 
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/20160614/900d8f02/attachment.html>


More information about the llvm-bugs mailing list