[LLVMbugs] [Bug 10109] New: Segfault compiling template with invalid nested type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 9 02:11:01 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10109

           Summary: Segfault compiling template with invalid nested type
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: max at duempel.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=6715)
 --> (http://llvm.org/bugs/attachment.cgi?id=6715)
test source code

The attached source code cannot be compiled with clang trunk/2.9. It is
important that both the "template" and the "protected" keywords are present;
with "public" or "private", it does not crash. I get the following crash
message:

bug.cpp:5:13: error: template specialization or definition requires a template
parameter list corresponding to the nested type 'A<T>'
  struct B::C;
            ^
bug.cpp:5:13: error: no struct named 'C' in 'A::B'
  struct B::C;
         ~~~^
0  clang           0x00000000017e537f
1  clang           0x00000000017e57e9
2  libpthread.so.0 0x00007f81adad9020
3  clang           0x00000000008dfe1a
4  clang           0x00000000008e1359
5  clang           0x00000000008e2511
6  clang           0x00000000008e2779
7  clang           0x00000000008ebdc2
clang::Sema::HandleDelayedAccessCheck(clang::sema::DelayedDiagnostic&,
clang::Decl*) + 1602
8  clang           0x000000000096c7fc
clang::Sema::DelayedDiagnostics::popParsingDecl(clang::Sema&,
clang::Sema::ParsingDeclState, clang::Decl*) + 124
9  clang           0x00000000008b4307
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject*) + 5799
10 clang           0x00000000008b522f
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 1455
11 clang           0x00000000008b6360
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool) + 3376
12 clang           0x00000000008a3d51
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 1345
13 clang           0x0000000000886ddd
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::ParsingDeclRAIIObject&, clang::SourceLocation&,
clang::AccessSpecifier) + 749
14 clang           0x000000000088a106
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier) + 614
15 clang           0x00000000008a841a
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 458
16 clang           0x0000000000896931
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 769
17 clang           0x00000000008974bc
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 140
18 clang           0x0000000000870c9d clang::ParseAST(clang::Sema&, bool) + 253
19 clang           0x0000000000750e13 clang::CodeGenAction::ExecuteAction() +
51
20 clang           0x000000000066a9a3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 307
21 clang           0x000000000064a74b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 955
22 clang           0x000000000063ff62 cc1_main(char const**, char const**, char
const*, void*) + 706
23 clang           0x0000000000649106 main + 678
24 libc.so.6       0x00007f81acdbfead __libc_start_main + 253
25 clang           0x000000000063fb39
Stack dump:
0.      Program arguments: /usr/local/stow/llvm/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -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.21.52.20110606
-momit-leaf-frame-pointer -resource-dir
/usr/local/stow/llvm/bin/../lib/clang/3.0 -fdeprecated-macro -ferror-limit 19
-fmessage-length 266 -fcxx-exceptions -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-MO7CtE.o -x c++
bug.cpp 
1.      bug.cpp:6:1: current parser token '}'
2.      bug.cpp:2:1: parsing struct/union/class body 'A'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)

-- 
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