[llvm-bugs] [Bug 32732] New: Clang crashes on code completion in comment [clang::Lexer::Lex (this=0x0, Result=...), clang::Preprocessor::Lex (this=0x450df0, Result=...)]

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 21 00:58:30 PDT 2017


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

            Bug ID: 32732
           Summary: Clang crashes on code completion in comment
                    [clang::Lexer::Lex (this=0x0, Result=...),
                    clang::Preprocessor::Lex (this=0x450df0, Result=...)]
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kfunk at kde.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

LLVM @ https://llvm.org/svn/llvm-project/llvm/trunk@300096
Clang @ https://llvm.org/svn/llvm-project/cfe/trunk@300074

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:
  https://bugs.kde.org/show_bug.cgi?id=372686

-- 
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/20170421/11fa715d/attachment.html>


More information about the llvm-bugs mailing list