Open jstaursky opened 4 years ago
i can repro with the provided testcase, too.
$ /usr/local/hrt-localcoding/bin/ccls --version
ccls version 0.20190823.4-7-gf35e93d5
clang version 9.0.0 (https://github.com/llvm/llvm-project.git 0399d5a9682b3cef71c653373e38890c63c4c365)
backtrace:
#1 0x0000556372fa904f in clang::Sema::CodeCompleteMemberReferenceExpr(clang::Scope*, clang::Expr*, clang::Expr*, clang::SourceLocation, bool, bool, clang::QualType) ()
#2 0x0000556372d598f8 in clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) ()
#3 0x0000556372d53502 in clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) ()
#4 0x0000556372d55db4 in clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState, bool) ()
#5 0x0000556372d5b5a7 in clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&) ()
#6 0x0000556372d536d5 in clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) ()
#7 0x0000556372d55db4 in clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState, bool) ()
#8 0x0000556372d55e3c in clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) ()
#9 0x0000556372d58081 in clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&, llvm::SmallVectorImpl<clang::SourceLocation>&, llvm::function_ref<void ()>) ()
#10 0x0000556372d5935c in clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) ()
#11 0x0000556372d53502 in clang::Parser::ParseCastExpression(bool, bool, bool&, clang::Parser::TypeCastState, bool) ()
#12 0x0000556372d55db4 in clang::Parser::ParseCastExpression(bool, bool, clang::Parser::TypeCastState, bool) ()
#13 0x0000556372d56479 in clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) ()
#14 0x0000556372d55e4c in clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) ()
#15 0x0000556372d55ef9 in clang::Parser::ParseExpression(clang::Parser::TypeCastState) ()
#16 0x0000556372da2012 in clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) ()
#17 0x0000556372da0c72 in clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) ()
#18 0x0000556372da1036 in clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) ()
#19 0x0000556372d9cf19 in clang::Parser::ParseCompoundStatementBody(bool) ()
#20 0x0000556372d9d78e in clang::Parser::ParseCompoundStatement(bool, unsigned int) ()
#21 0x0000556372d9d7c2 in clang::Parser::ParseCompoundStatement(bool) ()
#22 0x0000556372da0a22 in clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) ()
#23 0x0000556372da1036 in clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) ()
#24 0x0000556372da1257 in clang::Parser::ParseStatement(clang::SourceLocation*, clang::Parser::ParsedStmtContext) ()
#25 0x0000556372da38b0 in clang::Parser::ParseWhileStatement(clang::SourceLocation*) ()
#26 0x0000556372da0843 in clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&) ()
#27 0x0000556372da1036 in clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) ()
#28 0x0000556372d9cf19 in clang::Parser::ParseCompoundStatementBody(bool) ()
#29 0x0000556372da76ae in clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) ()
#30 0x0000556372d14251 in clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) ()
#31 0x0000556372d3415b in clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) ()
#32 0x0000556372d0de97 in clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) ()
#33 0x0000556372d0e6f9 in clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.214] ()
#34 0x0000556372d0e72f in clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) ()
#35 0x0000556372d157d0 in clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) ()
#36 0x0000556372d165d0 in clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) ()
#37 0x0000556372d09ee5 in clang::ParseAST(clang::Sema&, bool, bool) ()
#38 0x0000556372c820b1 in clang::FrontendAction::Execute() ()
#39 0x0000556372a9bd2f in ccls::(anonymous namespace)::parse (clang=...) at /usr/scratch/joel/ccls/src/sema_manager.cc:332
#40 0x0000556372a9d466 in ccls::(anonymous namespace)::completionMain (manager_=0x7fffd52c5aa0) at /usr/scratch/joel/ccls/src/sema_manager.cc:493
#41 0x00007f4b4d4644a4 in start_thread (arg=0x7f4b35ffe700) at pthread_create.c:456
#42 0x00007f4b4ccc9eef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97```
Cannot reproduce with clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-16.04/ (https://releases.llvm.org/download.html#9.0.0) or HEAD..
Observed behavior
Work on a fresh new .c file when trying to deference a pointer ccls crashed.
compile_commands.json
, just set ccls to accept my folder as project root and started coding. (Detailed info in reproduce section).Expected behavior
ccls to either give me error information or otherwise auto-complete suggestions.
Steps to reproduce
41e7d6a
this morning, but error also occurs in4711fd3
)9.0.1
) this morning (but the problem was also occurring when I was using9.0.0
)30250403a
but problem also occurs inf4f95d28f
) along with C/C++-layerc file
typedef struct Node { void data; struct Node left; // lesser struct Node right; // greater } Node, Tree;
int main (int argc, char argv[]) { Tree insert (char, Tree);
}
Tree insert (char word, Tree tree) { Tree tree_p = &tree; int compare;
}
LSP :: Connected to [ccls:11761 status:starting]. dap-gdb-lldb: webfreak.debug debug extension are not set. You can download it with M-x dap-gdb-lldb-setup LSP :: ccls:11761 initialized successfully ccls: expected expression [4] LSP :: ccls has exited (segmentation fault (core dumped)) Server ccls:11761 exited with status signal. Do you want to restart it? (y or n) n