[LLVMbugs] [Bug 11084] New: compiler assertion on strange templated code, probably noexcept related
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Oct 7 02:45:30 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=11084
Summary: compiler assertion on strange templated code, probably
noexcept related
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: davidhunter22 at gmail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
I was trying out the trunk of llvm/clang at revision 141361. This was build on
a Linux box "2.6.31-23-server #75-Ubuntu SMP Fri Mar 18 19:23:09 UTC 2011
x86_64 GNU/Linux" using gcc 4.6.0 which all went fine and seems to work.
However when I try to use the compiler using GCC 4.6.0 ( or 4.7.0 trunk )
standard C++ library header files I was getting a compiler assert
clang: /home/david/tools/llvm/3.0/llvm/tools/clang/lib/AST/Type.cpp:1616:
clang::FunctionProtoType::NoexceptResult
clang::FunctionProtoType::getNoexceptSpec(clang::ASTContext&) const: Assertion
`isICE && "AST should not contain bad noexcept expressions."' failed.
I was able to reduce the test case that causes this to the following still
quite complex code
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
template<typename T> struct Foo1
{
static constexpr bool foo( );
};
template<typename T> struct Foo2
{
typedef Foo2<T> Foo2_T;
};
template<typename T> struct Bar
{
typedef typename Foo2<int>::Foo2_T Foo2_T;
};
template<typename T> class Bar2
{
typedef Foo2<T> Foo2_T;
typedef Foo1<typename Bar<Foo2_T>::Foo2_T> Y;
Bar2& operator=(Bar2&&) noexcept(Y::foo());
};
template<typename T> T mod(T);
class Bar3
{
template<typename T> void generate( )
{
typename T::value_type r1;
r1 = mod<int>(1);
}
Bar2<int> v;
};
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
The full compiler output was
clang: /home/david/tools/llvm/3.0/llvm/tools/clang/lib/AST/Type.cpp:1616:
clang::FunctionProtoType::NoexceptResult
clang::FunctionProtoType::getNoexceptSpec(clang::ASTContext&) const: Assertion
`isICE && "AST should not contain bad noexcept expressions."' failed.
0 clang 0x0000000001bd655f
1 clang 0x0000000001bd6a61
2 libpthread.so.0 0x00007fe7c2a52190
3 libc.so.6 0x00007fe7c1d364b5 gsignal + 53
4 libc.so.6 0x00007fe7c1d39f50 abort + 384
5 libc.so.6 0x00007fe7c1d2f481 __assert_fail + 241
6 clang 0x0000000000fedfb2
7 clang 0x0000000000ab385b
clang::Sema::ImplicitExceptionSpecification::CalledDecl(clang::CXXMethodDecl*)
+ 187
8 clang 0x0000000000ac5559
clang::Sema::ComputeDefaultedMoveAssignmentExceptionSpec(clang::CXXRecordDecl*)
+ 601
9 clang 0x0000000000ac55b3
clang::Sema::DeclareImplicitMoveAssignment(clang::CXXRecordDecl*) + 35
10 clang 0x0000000000b6cff0
11 clang 0x0000000000b729f7
clang::Sema::CppLookupName(clang::LookupResult&, clang::Scope*) + 135
12 clang 0x0000000000b73768
clang::Sema::LookupName(clang::LookupResult&, clang::Scope*, bool) + 936
13 clang 0x0000000000b739a5
clang::Sema::LookupOverloadedOperatorName(clang::OverloadedOperatorKind,
clang::Scope*, clang::QualType, clang::QualType, clang::UnresolvedSetImpl&) +
245
14 clang 0x0000000000b1a243 clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) +
531
15 clang 0x0000000000b1a315 clang::Sema::ActOnBinOp(clang::Scope*,
clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) + 197
16 clang 0x00000000009e02f8
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level) + 520
17 clang 0x00000000009e0a7f
clang::Parser::ParseAssignmentExpression() + 47
18 clang 0x00000000009e17a9 clang::Parser::ParseExpression() + 9
19 clang 0x00000000009a47b2
clang::Parser::ParseExprStatement(clang::ParsedAttributes&) + 50
20 clang 0x00000000009a1378
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool) + 2168
21 clang 0x000000000099e2b9
clang::Parser::ParseCompoundStatementBody(bool) + 489
22 clang 0x000000000099f035
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 149
23 clang 0x00000000009baefe
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 398
24 clang 0x00000000009bacf1
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 145
25 clang 0x00000000009d8f34
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 157
26 clang 0x00000000009da201
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 3953
27 clang 0x00000000009c8aa3
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 1971
28 clang 0x00000000009b4679
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 89
29 clang 0x00000000009b4bc6
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 678
30 clang 0x00000000009b6c0f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2639
31 clang 0x00000000009b7037
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 167
32 clang 0x000000000098ed3d clang::ParseAST(clang::Sema&, bool) + 269
33 clang 0x000000000085ae04 clang::CodeGenAction::ExecuteAction() +
68
34 clang 0x0000000000745e85
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 373
35 clang 0x000000000072c88e
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1182
36 clang 0x00000000007218c8 cc1_main(char const**, char const**, char
const*, void*) + 840
37 clang 0x000000000072b024 main + 708
38 libc.so.6 0x00007fe7c1d21abd __libc_start_main + 253
39 clang 0x00000000007213f9
Stack dump:
0. Program arguments: /home/david/tools/llvm/3.0/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
bug.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.20 -momit-leaf-frame-pointer -resource-dir
/home/david/tools/llvm/3.0/bin/../lib/clang/3.0 -I
/home/david/tools/gcc/4.7.0/include/c++/4.7.0/x86_64-unknown-linux-gnu -I
/home/david/tools/gcc/4.7.0/include/c++/4.7.0 -fmodule-cache-path
/var/tmp/clang-module-cache -std=gnu++0x -fdeprecated-macro -ferror-limit 19
-fmessage-length 120 -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/bug-XE12MK.o -x c++
bug.cpp
1. bug.cpp:33:25: current parser token ';'
2. bug.cpp:27:1: parsing struct/union/class body 'Bar3'
3. bug.cpp:30:5: parsing function body 'generate'
4. bug.cpp:30:5: in compound statement ('{}')
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/bug-6Xz0CW.ii
The command line options I passed to clang were
-I/home/david/tools/gcc/4.7.0/include/c++/4.7.0/x86_64-unknown-linux-gnu
-I/home/david/tools/gcc/4.7.0/include/c++/4.7.0 -std=gnu++0
So really just telling it where the GCC stuff is.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list