<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Segfault after diagnostic with ill-formed _Pragma"
href="http://llvm.org/bugs/show_bug.cgi?id=20662">20662</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Segfault after diagnostic with ill-formed _Pragma
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hstong@ca.ibm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>