[LLVMbugs] [Bug 19101] New: Clang crashes on simple code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 10 14:31:03 PDT 2014


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

            Bug ID: 19101
           Summary: Clang crashes on simple code
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marekrusinowski at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 32329 [details]
Preprocessed source

(Crashes gcc too, bug report:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60493)

This simple incorrect code (works here to: http://ideone.com/QPwEPO):


  #include <iterator>

  template <class T>
  class Splay {
    public:
      class iterator;
  };

  template <class T, class D>
  class Splay<T>::iterator : std::iterator<std::forward_iterator_tag, D> {
  };

  Splay<int>::iterator it;


Crashes clang with output:


gcc_segfault.cpp:9:1: error: too many template parameters in template
redeclaration
    template <class T, class D>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    gcc_segfault.cpp:3:1: note: previous template declaration is here
    template <class T>
    ^~~~~~~~~~~~~~~~~~
    0  libLLVM-3.2.so.1 0x00002affdc0038df
    1  libLLVM-3.2.so.1 0x00002affdc003d49
    2  libpthread.so.0  0x00002affdca11880
    3  clang            0x0000000000f853c0 clang::TagType::getDecl() const + 0
    4  clang            0x00000000009ab044
    5  clang            0x00000000009c17a3
clang::Sema::DeclareImplicitCopyConstructor(clang::CXXRecordDecl*) + 643
    6  clang            0x0000000000a7dfbb
clang::Sema::LookupConstructors(clang::CXXRecordDecl*) + 251
    7  clang            0x0000000000a67005
    8  clang            0x0000000000a70942
clang::InitializationSequence::InitializationSequence(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
clang::Expr**, unsigned int) + 1522
    9  clang            0x0000000000977c7c
clang::Sema::ActOnUninitializedDecl(clang::Decl*, bool) + 428
    10 clang            0x00000000008861fb
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 203
    11 clang            0x000000000088eaa4
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 420
    12 clang            0x000000000087d914
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 228
    13 clang            0x000000000087e0a9
    14 clang            0x000000000087e0df
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 31
    15 clang            0x000000000087f583
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 83
    16 clang            0x000000000088021f
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 191
    17 clang            0x000000000087886a clang::ParseAST(clang::Sema&, bool,
bool) + 266
    18 clang            0x0000000000618101 clang::FrontendAction::Execute() +
97
    19 clang            0x00000000005ff6ea
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 282
    20 clang            0x00000000005e9152
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1378
    21 clang            0x00000000005e4258 cc1_main(char const**, char const**,
char const*, void*) + 1144
    22 clang            0x00000000005e313f main + 7247
    23 libc.so.6        0x00002affdd869b45 __libc_start_main + 245
    24 clang            0x00000000005e3c67
    Stack dump:
    0.  Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
gcc_segfault.cpp -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.23.52.20130727
-momit-leaf-frame-pointer -resource-dir /usr/bin/../lib/clang/3.2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.2/include -internal-isystem
/usr/include/clang/3.2/include/ -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/p2004a -ferror-limit 19
-fmessage-length 238 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/gcc_segfault-odFUkb.o -x c++ gcc_segfault.cpp 
    1.  gcc_segfault.cpp:13:24: 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)
    Debian clang version 3.2-11 (tags/RELEASE_32/final) (based on LLVM 3.2)
    Target: x86_64-pc-linux-gnu
    Thread model: posix
    clang: note: diagnostic msg: PLEASE submit a bug report to
http://bugs.debian.org/ 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/gcc_segfault-Nm2Ct7.cpp
    clang: note: diagnostic msg: /tmp/gcc_segfault-Nm2Ct7.sh
    clang: note: diagnostic msg: 

    ********************



Proccessed source (/tmp/gcc_segfault-Nm2Ct7.cpp) in attachment.
clang version:
Debian clang version 3.2-11 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix

-- 
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/20140310/1f6188ef/attachment.html>


More information about the llvm-bugs mailing list