[LLVMbugs] [Bug 23121] New: clang segfaults when processing macro code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 4 12:13:07 PDT 2015


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

            Bug ID: 23121
           Summary: clang segfaults when processing macro code
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ryan.burn at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Attached code and script to reproduce. Here is the stack trace:

0  clang-3.7       0x0000000001382fba
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 42
1  clang-3.7       0x000000000138465b
2  libpthread.so.0 0x00007fae16924b10
3  clang-3.7       0x00000000025ce07f
clang::TokenLexer::ExpandFunctionArguments() + 2431
4  clang-3.7       0x00000000025cd68f clang::TokenLexer::Init(clang::Token&,
clang::SourceLocation, clang::MacroInfo*, clang::MacroArgs*) + 319
5  clang-3.7       0x00000000025b0a2a
clang::Preprocessor::EnterMacro(clang::Token&, clang::SourceLocation,
clang::MacroInfo*, clang::MacroArgs*) + 154
6  clang-3.7       0x00000000025b3f33
clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&,
clang::MacroDirective*) + 2179
7  clang-3.7       0x00000000025cbb6d
clang::Preprocessor::HandleIdentifier(clang::Token&) + 1293
8  clang-3.7       0x00000000025ce951 clang::TokenLexer::Lex(clang::Token&) +
849
9  clang-3.7       0x00000000025cbbe6 clang::Preprocessor::Lex(clang::Token&) +
102
10 clang-3.7       0x00000000025cffeb
clang::MacroArgs::getPreExpArgument(unsigned int, clang::MacroInfo const*,
clang::Preprocessor&) + 331
11 clang-3.7       0x00000000025cd8c8
clang::TokenLexer::ExpandFunctionArguments() + 456
12 clang-3.7       0x00000000025cd68f clang::TokenLexer::Init(clang::Token&,
clang::SourceLocation, clang::MacroInfo*, clang::MacroArgs*) + 319
13 clang-3.7       0x00000000025b0a2a
clang::Preprocessor::EnterMacro(clang::Token&, clang::SourceLocation,
clang::MacroInfo*, clang::MacroArgs*) + 154
14 clang-3.7       0x00000000025b3f33
clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&,
clang::MacroDirective*) + 2179
15 clang-3.7       0x00000000025cbb6d
clang::Preprocessor::HandleIdentifier(clang::Token&) + 1293
16 clang-3.7       0x00000000025ce951 clang::TokenLexer::Lex(clang::Token&) +
849
17 clang-3.7       0x00000000025cbbe6 clang::Preprocessor::Lex(clang::Token&) +
102
18 clang-3.7       0x0000000001c3e042
clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&,
llvm::SmallVectorImpl<clang::SourceLocation>&, std::__1::function<void ()>) +
98
19 clang-3.7       0x0000000001c105a0
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) + 2976
20 clang-3.7       0x0000000001c0e613
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2915
21 clang-3.7       0x0000000001bfe16d
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 733
22 clang-3.7       0x0000000001bfdc70
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 384
23 clang-3.7       0x0000000001bfd1a6
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2854
24 clang-3.7       0x0000000001bfc5b8
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 360
25 clang-3.7       0x0000000001bf9320 clang::ParseAST(clang::Sema&, bool, bool)
+ 256
26 clang-3.7       0x00000000014fa539 clang::FrontendAction::Execute() + 57
27 clang-3.7       0x00000000014cfcd3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 803
28 clang-3.7       0x000000000156b115
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3381
29 clang-3.7       0x000000000070cd2f cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 719
30 clang-3.7       0x000000000070bf0a main + 11226
31 libc.so.6       0x00007fae15e62b95 __libc_start_main + 245
32 clang-3.7       0x0000000000709201
Stack dump:
0.    Program arguments: /usr/local/bin/clang-3.7 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name t.cpp -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 -resource-dir /usr/local/bin/../lib/clang/3.7.0 -I
/home/rnburn/proj -internal-isystem /usr/local/bin/../include/c++/v1
-internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.7.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++1y -fdeprecated-macro
-fdebug-compilation-dir /home/rnburn/bugs -ferror-limit 19 -fmessage-length 80
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/t-5f1fa8.o -x c++ t.cpp 
1.    t.cpp:97:9 <Spelling=<invalid>>: unknown current parser token
clang-3.7: error: unable to execute command: Segmentation fault
clang-3.7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0 (trunk 233507)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang-3.7: 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.7: 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.7: note: diagnostic msg: /tmp/t-3fb1e2.cpp
clang-3.7: note: diagnostic msg: /tmp/t-3fb1e2.sh
clang-3.7: 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/20150404/2a29bfe1/attachment.html>


More information about the llvm-bugs mailing list