[LLVMbugs] [Bug 20662] New: Segfault after diagnostic with ill-formed _Pragma

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 14 05:59:40 PDT 2014


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

            Bug ID: 20662
           Summary: Segfault after diagnostic with ill-formed _Pragma
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang crashes with a segmentation fault when _Pragma is used with the open
parenthesis as the last pp-token in the file following processing of later
elements.

### SOURCE:
$ cat pragmaSegv.c 
_Pragma(


### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -x c pragmaSegv.c 
pragmaSegv.c:1:1: error: _Pragma takes a parenthesized string literal
_Pragma(
^
0  clang           0x0000000003bc0a41 llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x0000000003bc0cbe
2  clang           0x0000000003bc0664
3  libpthread.so.0 0x00007f50f511d340
4  clang           0x00000000027029ac clang::Lexer::Lex(clang::Token&) + 32
5  clang           0x0000000002751cd9 clang::Preprocessor::Lex(clang::Token&) +
103
6  clang           0x0000000002742c7c
clang::Preprocessor::Handle_Pragma(clang::Token&) + 350
7  clang           0x000000000273a388
clang::Preprocessor::ExpandBuiltinMacro(clang::Token&) + 156
8  clang           0x0000000002735ce2
clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&,
clang::MacroDirective*) + 328
9  clang           0x0000000002751a18
clang::Preprocessor::HandleIdentifier(clang::Token&) + 524
10 clang           0x00000000026fe891
clang::Lexer::LexIdentifier(clang::Token&, char const*) + 307
11 clang           0x0000000002703569
clang::Lexer::LexTokenInternal(clang::Token&, bool) + 2759
12 clang           0x0000000002702a68 clang::Lexer::Lex(clang::Token&) + 220
13 clang           0x0000000002751cd9 clang::Preprocessor::Lex(clang::Token&) +
103
14 clang           0x0000000001591772
15 clang           0x0000000001595102 clang::Parser::Initialize() + 2010
16 clang           0x000000000158ea7a clang::ParseAST(clang::Sema&, bool, bool)
+ 302
17 clang           0x0000000001064872 clang::ASTFrontendAction::ExecuteAction()
+ 322
18 clang           0x00000000010643a7 clang::FrontendAction::Execute() + 139
19 clang           0x00000000010301b7
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 721
20 clang           0x0000000000ff57b3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 993
21 clang           0x0000000000fe3512 cc1_main(char const**, char const**, char
const*, void*) + 722
22 clang           0x0000000000ff0186 main + 769
23 libc.so.6       0x00007f50f4344ec5 __libc_start_main + 245
24 clang           0x0000000000fe1b89
Stack dump:
0.    Program arguments: clang -cc1 -x c pragmaSegv.c 
1.    <unknown> parser at unknown location
Segmentation fault (core dumped)


### COMPILER VERSION INFO:
$ clang -v
clang version 3.5.0 (trunk 214060)
Target: x86_64-unknown-linux-gnu
Thread model: posix
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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
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/20140814/a15c444e/attachment.html>


More information about the llvm-bugs mailing list