<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Clang crashes on code completion in comment [clang::Lexer::Lex (this=0x0, Result=...), clang::Preprocessor::Lex (this=0x450df0, Result=...)]"
href="https://bugs.llvm.org/show_bug.cgi?id=32732">32732</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang crashes on code completion in comment [clang::Lexer::Lex (this=0x0, Result=...), clang::Preprocessor::Lex (this=0x450df0, Result=...)]
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kfunk@kde.org
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>LLVM @ <a href="https://llvm.org/svn/llvm-project/llvm/trunk@300096">https://llvm.org/svn/llvm-project/llvm/trunk@300096</a>
Clang @ <a href="https://llvm.org/svn/llvm-project/cfe/trunk@300074">https://llvm.org/svn/llvm-project/cfe/trunk@300074</a>
I can reproduce the crash with Clang 3.8/3.9/4.0 & current trunk.
Test case:
% cat ~/test5.c
#include "test5.h"
% cat ~/test5.h
#pragma once
struct a {
/* <CURSOR_HERE> */
struct {
} b;
};
% clang++ -cc1 -xc -fsyntax-only -code-completion-at /home/kfunk/test5.h:4:7
/home/kfunk/test5.c
Backtrace:
Thread 1 (Thread 0x7ffff3125740 (LWP 23633)):
#0 clang::Lexer::Lex (this=0x0, Result=...) at
/home/kfunk/devel/src/llvm/tools/clang/lib/Lex/Lexer.cpp:2912
#1 0x00007ffff415bd24 in clang::Preprocessor::Lex (this=0x450df0, Result=...)
at /home/kfunk/devel/src/llvm/tools/clang/lib/Lex/Preprocessor.cpp:745
#2 0x00007ffff3f92306 in clang::Parser::ConsumeToken (this=0x498000) at
/home/kfunk/devel/src/llvm/tools/clang/include/clang/Parse/Parser.h:313
#3 clang::Parser::ParseDeclOrFunctionDefInternal (this=0x498000, attrs=...,
DS=..., AS=clang::AS_none) at
/home/kfunk/devel/src/llvm/tools/clang/lib/Parse/Parser.cpp:932
#4 0x00007ffff3f91f69 in clang::Parser::ParseDeclarationOrFunctionDefinition
(this=0x498000, attrs=..., DS=<optimized out>, AS=clang::AS_none) at
/home/kfunk/devel/src/llvm/tools/clang/lib/Parse/Parser.cpp:1001
#5 0x00007ffff3f91564 in clang::Parser::ParseExternalDeclaration
(this=0x498000, attrs=..., DS=0x0) at
/home/kfunk/devel/src/llvm/tools/clang/lib/Parse/Parser.cpp:851
#6 0x00007ffff3f906d7 in clang::Parser::ParseTopLevelDecl (this=0x498000,
Result=...) at /home/kfunk/devel/src/llvm/tools/clang/lib/Parse/Parser.cpp:624
#7 0x00007ffff3f90139 in clang::Parser::ParseFirstTopLevelDecl (this=0x498000,
Result=...) at /home/kfunk/devel/src/llvm/tools/clang/lib/Parse/Parser.cpp:558
#8 0x00007ffff3f08975 in clang::ParseAST (S=..., PrintStats=<optimized out>,
SkipFunctionBodies=<optimized out>) at
/home/kfunk/devel/src/llvm/tools/clang/lib/Parse/ParseAST.cpp:146
#9 0x00007ffff608975f in clang::FrontendAction::Execute (this=0x44e1f0) at
/home/kfunk/devel/src/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:512
#10 0x00007ffff604d288 in clang::CompilerInstance::ExecuteAction
(this=0x44bf80, Act=...) at
/home/kfunk/devel/src/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:969
#11 0x00007ffff5fd57c1 in clang::ExecuteCompilerInvocation (Clang=<optimized
out>) at
/home/kfunk/devel/src/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:249
#12 0x000000000040def1 in cc1_main (Argv=..., Argv0=<optimized out>,
MainAddr=<optimized out>) at
/home/kfunk/devel/src/llvm/tools/clang/tools/driver/cc1_main.cpp:221
#13 0x000000000040c669 in ExecuteCC1Tool (Tool=..., argv=...) at
/home/kfunk/devel/src/llvm/tools/clang/tools/driver/driver.cpp:299
#14 main (argc_=<optimized out>, argv_=<optimized out>) at
/home/kfunk/devel/src/llvm/tools/clang/tools/driver/driver.cpp:380
This seems to cause frequent crashes inside KDevelop. See downstream bug
report:
<a href="https://bugs.kde.org/show_bug.cgi?id=372686">https://bugs.kde.org/show_bug.cgi?id=372686</a></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>