[LLVMbugs] [Bug 18873] New: Segfault on invalid code
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Feb 17 10:14:57 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18873
Bug ID: 18873
Summary: Segfault on invalid code
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: will at wmitchell.net
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 12079
--> http://llvm.org/bugs/attachment.cgi?id=12079&action=edit
Reduced test case
I was investigating a segfault in clang-modernizer. The full pre-processed file
works with clang++ -fsyntax-only, but segfaults clang-modernizer. However,
after using delta to reduce the file, it resulted in a segfault in clang++.
Reduced file is attached, output from command-line below. Tested with r201520.
will at gauss:~/temp/modernizercrash$
~/Repos/llvm_projects/build-debug/bin/clang++ -fsyntax-only -v testcase.cpp
clang version 3.5
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i486-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i486-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multiilb: .;@m64
Selected multilib: .;@m64
"/home/will/Repos/llvm_projects/build-debug/bin/clang-3.5" -cc1 -triple
x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name
testcase.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -v -resource-dir
/home/will/Repos/llvm_projects/build-debug/bin/../lib/clang/3.5
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
-internal-isystem /usr/local/include -internal-isystem
/home/will/Repos/llvm_projects/build-debug/bin/../lib/clang/3.5/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/will/temp/modernizercrash
-ferror-limit 19 -fmessage-length 211 -mstackrealign -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -x c++ testcase.cpp
clang -cc1 version 3.5 based upon LLVM 3.5svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
/usr/local/include
/home/will/Repos/llvm_projects/build-debug/bin/../lib/clang/3.5/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
testcase.cpp:8:5: error: expected member name or ';' after declaration
specifiers
{
^
testcase.cpp:12:6: error: unknown type name '_Callback_list'
_Callback_list* _M_callbacks;
^
testcase.cpp:13:47: error: use of class template 'basic_ios' requires template
arguments
basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
^
testcase.cpp:4:11: note: template is declared here
class basic_ios;
^
testcase.cpp:13:33: error: out-of-line definition of 'copyfmt' from class
'basic_ios<_CharT, _Traits>' without definition
basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
testcase.cpp:13:33: error: C++ requires a type specifier for all declarations
basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
~~~~~~~~~ ^
testcase.cpp:13:33: error: template specialization or definition requires a
template parameter list corresponding to the nested type 'basic_ios<_CharT,
_Traits>'
basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
testcase.cpp:15:24: error: expected '}'
_M_callbacks = __cb;
^
testcase.cpp:7:3: note: to match this '{'
{
^
clang-3.5:
/home/will/Repos/llvm_projects/llvm/tools/clang/include/clang/AST/DeclCXX.h:562:
const struct DefinitionData &clang::CXXRecordDecl::data() const: Assertion
`DefinitionData && "queried property of class with no definition"' failed.
0 clang-3.5 0x000000000108280e llvm::sys::PrintStackTrace(_IO_FILE*) +
46
1 clang-3.5 0x0000000001082aeb
2 clang-3.5 0x000000000108420e
3 libpthread.so.0 0x00007f1d8d0c2210
4 libc.so.6 0x00007f1d8c30c1d5 gsignal + 53
5 libc.so.6 0x00007f1d8c30f388 abort + 328
6 libc.so.6 0x00007f1d8c305252
7 libc.so.6 0x00007f1d8c305302
8 clang-3.5 0x00000000018a17e6
9 clang-3.5 0x0000000001882275
10 clang-3.5 0x0000000002f911cb clang::CXXRecordDecl::forallBases(bool
(*)(clang::CXXRecordDecl const*, void*), void*, bool) const + 91
11 clang-3.5 0x00000000027e4874
12 clang-3.5 0x00000000027dc249
13 clang-3.5 0x00000000027dbb4c
clang::Sema::BuildPossibleImplicitMemberExpr(clang::CXXScopeSpec const&,
clang::SourceLocation, clang::LookupResult&, clang::TemplateArgumentListInfo
const*) + 60
14 clang-3.5 0x000000000259f676 clang::Sema::ClassifyName(clang::Scope*,
clang::CXXScopeSpec&, clang::IdentifierInfo*&, clang::SourceLocation,
clang::Token const&, bool, clang::CorrectionCandidateCallback*) + 5222
15 clang-3.5 0x00000000022f64b8 clang::Parser::TryAnnotateName(bool,
clang::CorrectionCandidateCallback*) + 1000
16 clang-3.5 0x0000000002367ea3
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 1011
17 clang-3.5 0x0000000002367995
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 133
18 clang-3.5 0x000000000236e93c
clang::Parser::ParseCompoundStatementBody(bool) + 1388
19 clang-3.5 0x000000000237203f
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 319
20 clang-3.5 0x00000000023834b7
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 1447
21 clang-3.5 0x0000000002382f04
clang::Parser::LexedMethod::ParseLexedMethodDefs() + 36
22 clang-3.5 0x0000000002382722
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 306
23 clang-3.5 0x0000000002327fb0
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 4224
24 clang-3.5 0x00000000023269b9
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 9401
25 clang-3.5 0x0000000002309eaa
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 10266
26 clang-3.5 0x00000000023765c7
clang::Parser::ParseNonTypeTemplateParameter(unsigned int, unsigned int) + 119
27 clang-3.5 0x00000000023755af
clang::Parser::ParseTemplateParameter(unsigned int, unsigned int) + 143
28 clang-3.5 0x00000000023753c3
clang::Parser::ParseTemplateParameterList(unsigned int,
llvm::SmallVectorImpl<clang::Decl*>&) + 67
29 clang-3.5 0x0000000002374788
clang::Parser::ParseTemplateParameters(unsigned int,
llvm::SmallVectorImpl<clang::Decl*>&, clang::SourceLocation&,
clang::SourceLocation&) + 248
30 clang-3.5 0x000000000237437e
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 526
31 clang-3.5 0x0000000002374057
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 215
32 clang-3.5 0x00000000023071c0
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 464
33 clang-3.5 0x00000000022f1611
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2385
34 clang-3.5 0x00000000022f0a6f
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 703
35 clang-3.5 0x00000000022eb181 clang::ParseAST(clang::Sema&, bool, bool)
+ 545
36 clang-3.5 0x0000000001260cf9 clang::ASTFrontendAction::ExecuteAction()
+ 345
37 clang-3.5 0x000000000126041f clang::FrontendAction::Execute() + 191
38 clang-3.5 0x000000000122d9ad
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 797
39 clang-3.5 0x0000000001387809
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1049
40 clang-3.5 0x000000000086ceea cc1_main(char const**, char const**, char
const*, void*) + 698
41 clang-3.5 0x0000000000865064 main + 772
42 libc.so.6 0x00007f1d8c2f8995 __libc_start_main + 245
43 clang-3.5 0x0000000000864c14
Stack dump:
0. Program arguments:
/home/will/Repos/llvm_projects/build-debug/bin/clang-3.5 -cc1 -triple
x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name
testcase.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -v -resource-dir
/home/will/Repos/llvm_projects/build-debug/bin/../lib/clang/3.5
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
-internal-isystem /usr/local/include -internal-isystem
/home/will/Repos/llvm_projects/build-debug/bin/../lib/clang/3.5/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/will/temp/modernizercrash
-ferror-limit 19 -fmessage-length 211 -mstackrealign -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -x c++ testcase.cpp
1. testcase.cpp:15:4: current parser token '_M_callbacks'
2. testcase.cpp:6:3: parsing struct/union/class body 'ios_base'
3. testcase.cpp:14:5: parsing function body 'copyfmt'
4. testcase.cpp:14:5: in compound statement ('{}')
clang-3.5: error: unable to execute command: Aborted
clang-3.5: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang-3.5: 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.5: 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.5: note: diagnostic msg: /tmp/testcase-f2fdb2.cpp
clang-3.5: note: diagnostic msg: /tmp/testcase-f2fdb2.sh
clang-3.5: note: diagnostic msg:
********************
will at gauss:~/temp/modernizercrash$
--
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/20140217/eb30685e/attachment.html>
More information about the llvm-bugs
mailing list