<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 --- - Assertion failure for local extern declarations of variables with names matching function parameters"
href="http://llvm.org/bugs/show_bug.cgi?id=16804">16804</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion failure for local extern declarations of variables with names matching function parameters
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>thonermann@coverity.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 3.3, when compiled with assertions enabled, fails an assertion for this
test case. I believe this code is ill-formed, but at least some versions of
gcc accept this test case (I tested 4.6.3 and 4.8.0). Clang 3.2 accepts this
test case as well.
$ cat t.cpp
struct S;
void f(S *s) {
extern S *s;
s;
}
$ clang --version
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang -c t.cpp
clang: llvm-3.3/tools/clang/lib/AST/Decl.cpp:932: void
clang::NamedDecl::verifyLinkage() const: Assertion `!D || D->CachedLinkage ==
CachedLinkage' failed.
0 clang 0x000000000308d84a llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1 clang 0x000000000308dad1
2 clang 0x000000000308d520
3 libpthread.so.0 0x00007f8f1aa70cb0
4 libc.so.6 0x00007f8f19cc2425 gsignal + 53
5 libc.so.6 0x00007f8f19cc5b8b abort + 379
6 libc.so.6 0x00007f8f19cbb0ee
7 libc.so.6 0x00007f8f19cbb192
8 clang 0x0000000001e63a0e clang::NamedDecl::verifyLinkage() const +
340
9 clang 0x0000000001e637cb clang::NamedDecl::getLinkage() const +
127
10 clang 0x0000000001e6bf90
11 clang 0x0000000001e6566a clang::VarDecl::getLanguageLinkage()
const + 24
12 clang 0x0000000001e6c09a
13 clang 0x0000000001e65684 clang::VarDecl::isExternC() const + 24
14 clang 0x00000000012d4a61
clang::Sema::ActOnVariableDeclarator(clang::Scope*, clang::Declarator&,
clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&,
llvm::MutableArrayRef<clang::TemplateParameterList*>) + 6435
15 clang 0x00000000012d1538
clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&,
llvm::MutableArrayRef<clang::TemplateParameterList*>) + 2910
16 clang 0x00000000012d0270
clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) + 80
17 clang 0x00000000011b453a
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 148
18 clang 0x00000000011b3f42
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1428
19 clang 0x00000000011b33fe
clang::Parser::ParseSimpleDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*)
+ 506
20 clang 0x00000000011b31b6
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 736
21 clang 0x000000000120285e
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 1542
22 clang 0x0000000001202168
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 128
23 clang 0x0000000001204b9f
clang::Parser::ParseCompoundStatementBody(bool) + 1239
24 clang 0x000000000120ad4c
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 322
25 clang 0x00000000011a2bfd
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
3519
26 clang 0x00000000011b3bd2
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 548
27 clang 0x00000000011a1d33
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 1079
28 clang 0x00000000011a1dfb
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 189
29 clang 0x00000000011a15af
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2783
30 clang 0x00000000011a0a9f
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 415
31 clang 0x000000000119d379 clang::ParseAST(clang::Sema&, bool, bool)
+ 597
32 clang 0x0000000000d77656 clang::ASTFrontendAction::ExecuteAction()
+ 298
33 clang 0x0000000000fb52d8 clang::CodeGenAction::ExecuteAction() +
1414
34 clang 0x0000000000d771d8 clang::FrontendAction::Execute() + 200
35 clang 0x0000000000d4a6d4
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 720
36 clang 0x0000000000d19d6c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1018
37 clang 0x0000000000d09bbb cc1_main(char const**, char const**, char
const*, void*) + 717
38 clang 0x0000000000d14317 main + 496
39 libc.so.6 0x00007f8f19cad76d __libc_start_main + 237
40 clang 0x0000000000d09299
Stack dump:
0. Program arguments: ./clang -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -mrelax-all -disable-free -main-file-name t.cpp -mrelocation-model
static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -target-linker-version 2.22 -coverage-file
t.o -resource-dir ./../lib/clang/3.3 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/x86_64-linux-gnu/c++/4.6
-internal-isystem /usr/local/include -internal-isystem
./../lib/clang/3.3/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 197
-mstackrealign -fobjc-runtime=gcc -fobjc-default-synthesize-properties
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-backend-option -vectorize-loops -o t.o -x c++ t.cpp
1. t.cpp:3:16: current parser token ';'
2. t.cpp:2:14: parsing function body 'f'
3. t.cpp:2:14: in compound statement ('{}')
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/t-LEdqHc.cpp
clang: note: diagnostic msg: /tmp/t-LEdqHc.sh
clang: note: diagnostic msg:
********************</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>