[llvm-bugs] [Bug 27695] New: Clang Crashed when compiling the Instantiate of a Class Template of a Union of a non-POD Class in C++11
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon May 9 18:13:53 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27695
Bug ID: 27695
Summary: Clang Crashed when compiling the Instantiate of a
Class Template of a Union of a non-POD Class in C++11
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: charles_li at playstation.sony.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 16343
--> https://llvm.org/bugs/attachment.cgi?id=16343&action=edit
Preprocessed source
This ICE is discovered while updating Lit test
CXX/class/class.union/p1.cpp
for C++11 compatibility.
Here is a reduced test case:
/*********************************/
class CopyCtor {
CopyCtor(CopyCtor &cc) { }
};
template <class B> struct Either {
union {
B b;
};
};
void fred() {
Either<CopyCtor> copyctor(0);
}
/*********************************/
Here is the crash dump when compiling in C++11:
clang-3.9:
/home/chli/Source/uclsvn/llvm/tools/clang/include/clang/AST/DeclCXX.h:924: void
clang::CXXRecordDecl::setImplicitMoveConstructorIsDeleted(): Assertion
`(data().DefaultedMoveConstructorIsDeleted ||
needsOverloadResolutionForMoveConstructor()) && "move constructor should not be
deleted"' failed.
0 clang-3.9 0x0000000002f4a58e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 44
1 clang-3.9 0x0000000002f4a8a3
2 clang-3.9 0x0000000002f48fbb llvm::sys::RunSignalHandlers() + 118
3 clang-3.9 0x0000000002f4a0b5
4 libpthread.so.0 0x00007f5ab5b96340
5 libc.so.6 0x00007f5ab4dbecc9 gsignal + 57
6 libc.so.6 0x00007f5ab4dc20d8 abort + 328
7 libc.so.6 0x00007f5ab4db7b86
8 libc.so.6 0x00007f5ab4db7c32
9 clang-3.9 0x00000000047804fb
10 clang-3.9 0x0000000004736516
clang::Sema::DeclareImplicitMoveConstructor(clang::CXXRecordDecl*) + 1042
11 clang-3.9 0x0000000004999223
clang::Sema::LookupConstructors(clang::CXXRecordDecl*) + 183
12 clang-3.9 0x0000000004970503
13 clang-3.9 0x0000000004975889
clang::InitializationSequence::InitializeFrom(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, bool, bool) + 2983
14 clang-3.9 0x0000000004974c2f
clang::InitializationSequence::InitializationSequence(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
llvm::MutableArrayRef<clang::Expr*>, bool, bool) + 209
15 clang-3.9 0x00000000046a8eb4
clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool, bool) +
4180
16 clang-3.9 0x00000000042cd7d2
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) + 3914
17 clang-3.9 0x00000000042cc236
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1966
18 clang-3.9 0x00000000042cb53d
clang::Parser::ParseSimpleDeclaration(unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*)
+ 733
19 clang-3.9 0x00000000042cb218 clang::Parser::ParseDeclaration(unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 622
20 clang-3.9 0x0000000004348486
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&) + 762
21 clang-3.9 0x0000000004347ee8
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*) + 164
22 clang-3.9 0x000000000434ada3
clang::Parser::ParseCompoundStatementBody(bool) + 1055
23 clang-3.9 0x000000000434e2a1
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 467
24 clang-3.9 0x00000000042b1414
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
3458
25 clang-3.9 0x00000000042cbeb4
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1068
26 clang-3.9 0x00000000042b058a
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 1120
27 clang-3.9 0x00000000042b064f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 189
28 clang-3.9 0x00000000042afdfe
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2822
29 clang-3.9 0x00000000042af2c8
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 724
30 clang-3.9 0x00000000042abb2a clang::ParseAST(clang::Sema&, bool, bool)
+ 651
31 clang-3.9 0x0000000003632ae2 clang::ASTFrontendAction::ExecuteAction()
+ 322
32 clang-3.9 0x0000000003a103d9 clang::CodeGenAction::ExecuteAction() +
1927
33 clang-3.9 0x00000000036325a7 clang::FrontendAction::Execute() + 135
34 clang-3.9 0x00000000035e7ad6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1022
35 clang-3.9 0x000000000372abfd
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1299
36 clang-3.9 0x0000000001716b06 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 1052
37 clang-3.9 0x000000000170d19e
38 clang-3.9 0x000000000170dc58 main + 2312
39 libc.so.6 0x00007f5ab4da9ec5 __libc_start_main + 245
40 clang-3.9 0x000000000170ab89
Stack dump:
0. Program arguments: /home/chli/Source/uclsvn/build/bin/clang-3.9 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name p1_copy.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
/home/chli/Source/uclsvn/llvm/tools/clang/test/p1_copy.cpp -resource-dir
/home/chli/Source/uclsvn/build/bin/../lib/clang/3.9.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem /usr/local/include -internal-isystem
/home/chli/Source/uclsvn/build/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
/home/chli/Source/uclsvn/llvm/tools/clang/test -ferror-limit 19
-fmessage-length 167 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o p1_copy.o -x c++ p1_copy.cpp
1. p1_copy.cpp:12:31: current parser token ';'
2. p1_copy.cpp:11:13: parsing function body 'fred'
3. p1_copy.cpp:11:13: 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 268812)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/chli/Source/uclsvn/build/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/p1_copy-d0d9a3.cpp
clang-3.9: note: diagnostic msg: /tmp/p1_copy-d0d9a3.sh
clang-3.9: note: diagnostic msg:
Here are the compiler diagnostics when compiling in C++98:
p1_copy.cpp:7:7: error: union member 'b' has a non-trivial copy constructor
B b;
^
p1_copy.cpp:6:3: note: in instantiation of member class
'Either<CopyCtor>::(anonymous union at p1_copy.cpp:6:3)' requested here
union {
^
p1_copy.cpp:12:20: note: in instantiation of template class 'Either<CopyCtor>'
requested here
Either<CopyCtor> copyctor(0);
^
p1_copy.cpp:1:7: note: because no constructor can be used to copy an object of
type 'const CopyCtor'
class CopyCtor {
^
1 error generated.
Thank you for looking into this.
--
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/20160510/f241a232/attachment-0001.html>
More information about the llvm-bugs
mailing list