[llvm-bugs] [Bug 27047] New: clang crashes on valid C++11 code

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 23 23:44:51 PDT 2016


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

            Bug ID: 27047
           Summary: clang crashes on valid C++11 code
           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 (as well 3.6.x and later) crashes when compiling the
following valid C++11 test case on x86_64-linux-gnu in both 32-bit and 64-bit
modes. 

This is a regression from 3.5.x.


$ clang++-trunk -v
clang version 3.9.0 (trunk 264141)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/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++-3.5.0 -std=c++11 small.cpp
$ g++-trunk -std=c++11 small.cpp
$ 
$ clang++-trunk -std=c++11 small.cpp
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaDeclCXX.cpp:11411:
clang::ExprResult clang::Sema::BuildCXXDefaultInitExpr(clang::SourceLocation,
clang::FieldDecl*): Assertion `Lookup.size() == 1' failed.
#0 0x0000000001c8a965 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c8a965)
#1 0x0000000001c888f6 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1c888f6)
#2 0x0000000001c88b14 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c88b14)
#3 0x00007f66b86b0340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f66b78cecc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f66b78d20d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f66b78c7b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f66b78c7c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x00000000029ca262 (/usr/local/clang-trunk/bin/clang-3.9+0x29ca262)
#9 0x00000000029e5f2c CollectFieldInitializer(clang::Sema&, (anonymous
namespace)::BaseAndFieldInfo&, clang::FieldDecl*, clang::IndirectFieldDecl*)
(/usr/local/clang-trunk/bin/clang-3.9+0x29e5f2c)
#10 0x0000000002a037db
clang::Sema::SetCtorInitializers(clang::CXXConstructorDecl*, bool,
llvm::ArrayRef<clang::CXXCtorInitializer*>)
(/usr/local/clang-trunk/bin/clang-3.9+0x2a037db)
#11 0x0000000002a04e98
clang::Sema::DefineImplicitDefaultConstructor(clang::SourceLocation,
clang::CXXConstructorDecl*) (/usr/local/clang-trunk/bin/clang-3.9+0x2a04e98)
#12 0x0000000002a75c4e
clang::Sema::MarkFunctionReferenced(clang::SourceLocation,
clang::FunctionDecl*, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x2a75c4e)
#13 0x00000000029c9d41
clang::Sema::BuildCXXConstructExpr(clang::SourceLocation, clang::QualType,
clang::CXXConstructorDecl*, bool, llvm::MutableArrayRef<clang::Expr*>, bool,
bool, bool, bool, unsigned int, clang::SourceRange)
(/usr/local/clang-trunk/bin/clang-3.9+0x29c9d41)
#14 0x00000000029c9e69
clang::Sema::BuildCXXConstructExpr(clang::SourceLocation, clang::QualType,
clang::CXXConstructorDecl*, llvm::MutableArrayRef<clang::Expr*>, bool, bool,
bool, bool, unsigned int, clang::SourceRange)
(/usr/local/clang-trunk/bin/clang-3.9+0x29c9e69)
#15 0x0000000002b186ff PerformConstructorInitialization(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step
const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation)
(/usr/local/clang-trunk/bin/clang-3.9+0x2b186ff)
#16 0x0000000002b272f8 clang::InitializationSequence::Perform(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2b272f8)
#17 0x0000000002986341 clang::Sema::ActOnUninitializedDecl(clang::Decl*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2986341)
#18 0x00000000026e2126
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-3.9+0x26e2126)
#19 0x00000000026eef65 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-3.9+0x26eef65)
#20 0x00000000026f1c04 clang::Parser::ParseSimpleDeclaration(unsigned int,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool,
clang::Parser::ForRangeInit*) (/usr/local/clang-trunk/bin/clang-3.9+0x26f1c04)
#21 0x00000000026f1f0d clang::Parser::ParseDeclaration(unsigned int,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26f1f0d)
#22 0x0000000002747e77
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2747e77)
#23 0x00000000027485ae
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-3.9+0x27485ae)
#24 0x000000000274cb29 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x274cb29)
#25 0x000000000274fdd5 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/local/clang-trunk/bin/clang-3.9+0x274fdd5)
#26 0x00000000026d048b
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x26d048b)
#27 0x00000000026ef7cd clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-3.9+0x26ef7cd)
#28 0x00000000026cbd4d
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x26cbd4d)
#29 0x00000000026cc3f1
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.228]
(/usr/local/clang-trunk/bin/clang-3.9+0x26cc3f1)
#30 0x00000000026cc42f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-3.9+0x26cc42f)
#31 0x00000000026d1410
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-3.9+0x26d1410)
#32 0x00000000026d1bd0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26d1bd0)
#33 0x00000000026c911b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x26c911b)
#34 0x000000000238ec1e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x238ec1e)
#35 0x00000000020cccb6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x20cccb6)
#36 0x00000000020a5386
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x20a5386)
#37 0x00000000021574f2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x21574f2)
#38 0x0000000000ab9d50 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xab9d50)
#39 0x0000000000a7639d main (/usr/local/clang-trunk/bin/clang-3.9+0xa7639d)
#40 0x00007f66b78b9ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#41 0x0000000000ab5dd4 _start (/usr/local/clang-trunk/bin/clang-3.9+0xab5dd4)
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
-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/c-hunter/test/fun/try5b/20160323-clang++-trunk-O3-m32-build-test8411-15
-ferror-limit 19 -fmessage-length 118 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/small-93e377.o -x c++ small.cpp 
1.    small.cpp:16:12: current parser token ';'
2.    small.cpp:15:1: parsing function body 'main'
3.    small.cpp:15: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 264141)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/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-65aed0.cpp
clang-3.9: note: diagnostic msg: /tmp/small-65aed0.sh
clang-3.9: note: diagnostic msg: 

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


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


struct A
{
  A (int) {}
  A (const A &) = delete;
};

template <typename T> 
struct S
{
  A S {0};
};

int
main ()
{
  S <int> s; 
  return 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/20160324/d323fd9f/attachment.html>


More information about the llvm-bugs mailing list