[LLVMbugs] [Bug 14577] New: clang crashes on some questionable code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 11 13:24:35 PST 2012


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

             Bug #: 14577
           Summary: clang crashes on some questionable code
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: bzsteck at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9678
  --> http://llvm.org/bugs/attachment.cgi?id=9678
combination of clangCrash-iX8vto.cpp and clangCrash-iX8vto.sh

I was in the middle of refactoring some code and stumbled across a clang crash.

I reduced the problematic code to:

template<typename T>
struct Outer
{
    template<typename U>
    struct Inner
    {
        ~Inner();
    };
};

template<typename T>
Outer<T>::Inner<T>::~Inner() = default;

void clangCrash()
{
}

And I compiled by this command:
clang++ -std=c++11 -c clangCrash.C

And got this output:

clangCrash.C:12:21: error: nested name specifier 'Outer<T>::Inner<T>::' for
      declaration does not refer into a class, class template or class template
      partial specialization
Outer<T>::Inner<T>::~Inner() = default;
~~~~~~~~~~~~~~~~~~~~^
0  clang           0x0000000001a8fd7f
1  clang           0x0000000001a900c9
2  libpthread.so.0 0x00007f9808dec500
3  clang           0x0000000000aa84fb
clang::Sema::SetDeclDefaulted(clang::Decl*, clang::SourceLocation) + 27
4  clang           0x0000000000948da7
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
2423
5  clang           0x00000000009ace96
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 3590
6  clang           0x00000000009ad708
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 680
7  clang           0x00000000009adbad
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 141
8  clang           0x000000000095996e
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 606
9  clang           0x0000000000947f24
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1636
10 clang           0x00000000009481ef
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 191
11 clang           0x000000000093fc9e clang::ParseAST(clang::Sema&, bool, bool)
+ 270
12 clang           0x00000000006c13c1 clang::FrontendAction::Execute() + 97
13 clang           0x00000000006a68c5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 277
14 clang           0x000000000068ef52
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1378
15 clang           0x00000000006879a0 cc1_main(char const**, char const**, char
const*, void*) + 880
16 clang           0x000000000068dc56 main + 8006
17 libc.so.6       0x00007f98080c2cdd __libc_start_main + 253
18 clang           0x0000000000686be5

Stack dump:
0.      Program arguments: /usr/local/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name clangCrash.C -mrelocation-model static
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version
2.20.51.0.7 -momit-leaf-frame-pointer -coverage-file
/mnt/home/steck/BallRace/zzzBUG/ClangCrash/clangCrash.o -resource-dir
/usr/local/bin/../lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache
-internal-isystem
/usr/lib/gcc/x86_64-amazon-linux/4.7.2/../../../../include/c++/4.7.2
-internal-isystem
/usr/lib/gcc/x86_64-amazon-linux/4.7.2/../../../../include/c++/4.7.2/x86_64-amazon-linux
-internal-isystem
/usr/lib/gcc/x86_64-amazon-linux/4.7.2/../../../../include/c++/4.7.2/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.2/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /mnt/home/steck/BallRace/zzzBUG/ClangCrash
-ferror-limit 19 -fmessage-length 80 -mstackrealign -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
clangCrash.o -x c++ clangCrash.C 
1.      clangCrash.C:12:39: current parser token ';'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (tags/RELEASE_32/rc3 169678)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: 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: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/clangCrash-iX8vto.cpp
clang: note: diagnostic msg: /tmp/clangCrash-iX8vto.sh
clang: note: diagnostic msg: 

********************
make: *** [clangCrash.o] Error 254

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