[llvm-bugs] [Bug 25161] New: ICE on invalid code in clang::Parser::ParseLexedMethodDeclaration(clang::Parser::LateParsedMethodDeclaration&)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 13 10:17:55 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25161

            Bug ID: 25161
           Summary: ICE on invalid code in
                    clang::Parser::ParseLexedMethodDeclaration(clang::Pars
                    er::LateParsedMethodDeclaration&)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: miyuki-llvm at miyuki.ru
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15065
  --> https://llvm.org/bugs/attachment.cgi?id=15065&action=edit
Preprocessed source

The following invalid code causes an ICE:

$ cat test.cc
struct foo
{
    foobar foo() throw() : t(0) { }
    int t;
};

$ clang++ -c test.cc
test.cc:3:5: error: unknown type name 'foobar'
    foobar foo() throw() : t(0) { }
    ^
test.cc:3:12: error: constructor cannot have a return type
    foobar foo() throw() : t(0) { }
           ^~~
0  clang-3.8       0x00000000017adbc5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang-3.8       0x00000000017ace36 llvm::sys::RunSignalHandlers() + 54
2  clang-3.8       0x00000000017ad025
3  libpthread.so.0 0x00007f0e9b7d98d0
4  clang-3.8       0x0000000002046ade
clang::Parser::ParseLexedMethodDeclaration(clang::Parser::LateParsedMethodDeclaration&)
+ 2094
5  clang-3.8       0x0000000002042616
clang::Parser::ParseLexedMethodDeclarations(clang::Parser::ParsingClass&) + 182
6  clang-3.8       0x00000000020726b2
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 1234
7  clang-3.8       0x00000000020736e6
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 2374
8  clang-3.8       0x0000000002054fbe
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 4814
9  clang-3.8       0x000000000203b184
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 84
10 clang-3.8       0x000000000203b889
11 clang-3.8       0x000000000203b8bf
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 31
12 clang-3.8       0x0000000002041a4f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 255
13 clang-3.8       0x0000000002042220
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 384
14 clang-3.8       0x0000000002037370 clang::ParseAST(clang::Sema&, bool, bool)
+ 432
15 clang-3.8       0x0000000001b4f4c6 clang::FrontendAction::Execute() + 262
16 clang-3.8       0x0000000001b2e069
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 297
17 clang-3.8       0x0000000001bcb433
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1939
18 clang-3.8       0x0000000000867a20 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2576
19 clang-3.8       0x0000000000828744 main + 5844
20 libc.so.6       0x00007f0e9aa05b45 __libc_start_main + 245
21 clang-3.8       0x0000000000865674
Stack dump:
0.      Program arguments: /opt/clang-trunk/bin/clang-3.8 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name test.cc -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 -coverage-file /home/miyuki/test/test.cc -resource-dir
/opt/clang-trunk/bin/../lib/clang/3.8.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/clang-trunk/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/miyuki/test -ferror-limit 19 -fmessage-length 237
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o test.o -x c++ test.cc 
1.      test.cc:3:18: current parser token 'throw'
2.      test.cc:1:1: parsing struct/union/class body 'foo'
clang-3.8: error: unable to execute command: Segmentation fault
clang-3.8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 250094)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/clang-trunk/bin
clang-3.8: 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.8: 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.8: note: diagnostic msg: /tmp/test-892d95.cpp
clang-3.8: note: diagnostic msg: /tmp/test-892d95.sh
clang-3.8: note: diagnostic msg: 

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

-- 
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/20151013/e4e3f5f0/attachment.html>


More information about the llvm-bugs mailing list