Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Crash] clangd crash If there is an "N" in the code #84122

Closed
Neojan opened this issue Mar 6, 2024 · 3 comments
Closed

[Crash] clangd crash If there is an "N" in the code #84122

Neojan opened this issue Mar 6, 2024 · 3 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@Neojan
Copy link

Neojan commented Mar 6, 2024

If there is an "N" in the code, it will cause cland crash
eg: printf("abcdefg \N");

StackTrace:
#0 0x000000000052eb73 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/runner/work/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:13
 #1 0x000000000052caec llvm::sys::RunSignalHandlers() /home/runner/work/clangd/clangd/llvm-project/llvm/lib/Support/Signals.cpp:104:18
 #2 0x000000000052eee6 SignalHandler(int) /home/runner/work/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #3 0x00007f5d054f18a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #4 0x0000000000a4fe8e clang::StringLiteralParser::init(llvm::ArrayRef<clang::Token>) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Lex/LiteralSupport.cpp:2099:24
 #5 0x0000000000ed077e clang::Sema::ActOnStringLiteral(llvm::ArrayRef<clang::Token>, clang::Scope*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Sema/SemaExpr.cpp:1861:23
 #6 0x0000000001dd9e1f clang::Parser::ParseStringLiteralExpression(bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:3218:18
 #7 0x0000000001dd2244 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:1291:11
 #8 0x0000000001dcf751 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:681:20
 #9 0x0000000001dcdf2c clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:176:10
#10 0x0000000001ddd2ba clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&, llvm::SmallVectorImpl<clang::SourceLocation>&, llvm::function_ref<void ()>, bool, bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:0:0
#11 0x0000000001dd0656 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*, true>) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:2058:15
#12 0x0000000001dd1e22 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&, clang::Parser::TypeCastState, bool, bool*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:1819:9
#13 0x0000000001dcf751 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:681:20
#14 0x0000000001dcdf2c clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:176:10
#15 0x0000000001dcde69 clang::Parser::ParseExpression(clang::Parser::TypeCastState) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:125:10
#16 0x0000000001e30ce5 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:509:19
#17 0x0000000001e2f34f clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:264:12
#18 0x0000000001e2ec66 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:114:20
#19 0x0000000001e37b81 clang::Parser::ParseCompoundStatementBody(bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:1157:11
#20 0x0000000001e2f674 ParseCompoundStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:966:10
#21 0x0000000001e2f674 ParseCompoundStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:931:10
#22 0x0000000001e2f674 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:279:12
#23 0x0000000001e2ec66 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:114:20
#24 0x0000000001e324aa ParseStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:41:11
#25 0x0000000001e324aa clang::Parser::ParseIfStatement(clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:1522:16
#26 0x0000000001e2f81e clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:286:12
#27 0x0000000001e2ec66 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:114:20
#28 0x0000000001e37b81 clang::Parser::ParseCompoundStatementBody(bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:1157:11
#29 0x0000000001e2f674 ParseCompoundStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:966:10
#30 0x0000000001e2f674 ParseCompoundStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:931:10
#31 0x0000000001e2f674 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:279:12
#32 0x0000000001e2ec66 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:114:20
#33 0x0000000001e37b81 clang::Parser::ParseCompoundStatementBody(bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:1157:11
#34 0x0000000001e390ad clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:2428:21
#35 0x0000000001d86569 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:0:0
#36 0x0000000001da3980 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseDecl.cpp:2121:18
#37 0x0000000001d853a2 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:1179:10
#38 0x0000000001d84de0 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:1193:12
#39 0x0000000001d83fd0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsingDeclSpec*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:1019:12
#40 0x0000000001d81adc clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:737:10
#41 0x0000000001d7d58e clang::ParseAST(clang::Sema&, bool, bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseAST.cpp:161:5
#42 0x0000000001b9219b clang::FrontendAction::Execute() /home/runner/work/clangd/clangd/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1041:10
#43 0x00000000014cc747 operator bool /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/Support/Error.h:235:21
#44 0x00000000014cc747 clang::clangd::BackgroundIndex::index(clang::tooling::CompileCommand) /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:322:19
#45 0x00000000014cf447 _M_data /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:187:28
#46 0x00000000014cf447 _M_is_local /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:222:16
#47 0x00000000014cf447 _M_dispose /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:231:7
#48 0x00000000014cf447 ~basic_string /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:658:9
#49 0x00000000014cf447 ~CompileCommand /home/runner/work/clangd/clangd/llvm-project/clang/include/clang/Tooling/CompilationDatabase.h:44:8
#50 0x00000000014cf447 operator() /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:165:22
#51 0x00000000014cf447 __invoke_impl<void, (lambda at /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:158:27) &> /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
#52 0x00000000014cf447 __invoke_r<void, (lambda at /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:158:27) &> /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:153:7
#53 0x00000000014cf447 std::_Function_handler<void (), clang::clangd::BackgroundIndex::indexFileTask(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::$_3>::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
#54 0x00000000014d30ff clang::clangd::BackgroundQueue::work(std::function<void ()>) /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/BackgroundQueue.cpp:43:25
#55 0x00000000014cddf2 ~_Function_base /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:244:11
#56 0x00000000014cddf2 operator() /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:111:27
#57 0x00000000014cddf2 void llvm::detail::UniqueFunctionBase<void>::CallImpl<clang::clangd::BackgroundIndex::BackgroundIndex(clang::clangd::ThreadsafeFS const&, clang::clangd::GlobalCompilationDatabase const&, llvm::unique_function<clang::clangd::BackgroundIndexStorage* (llvm::StringRef)>, clang::clangd::BackgroundIndex::Options)::$_1>(void*) /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
#58 0x0000000001564cb1 PointerIntPair /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:49:12
#59 0x0000000001564cb1 UniqueFunctionBase /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:340:3
#60 0x0000000001564cb1 unique_function /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:369:3
#61 0x0000000001564cb1 operator() /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:102:14
#62 0x0000000001564cb1 Apply<(lambda at /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:97:15)> /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:5
#63 0x0000000001564cb1 GenericThreadProxy<std::tuple<(lambda at /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:97:15)> > /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:50:5
#64 0x0000000001564cb1 void* llvm::thread::ThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1> >(void*) /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:60:5
#65 0x00007f5d054e66db start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76db)
#66 0x00007f5d04a65a3f clone /build/glibc-2ORdQG/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97:0
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Mar 6, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 6, 2024

@llvm/issue-subscribers-clang-frontend

Author: None (Neojan)

If there is an "N" in the code, it will cause cland crash eg: printf("abcdefg \N");
StackTrace:
#<!-- -->0 0x000000000052eb73 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) /home/runner/work/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:13
 #<!-- -->1 0x000000000052caec llvm::sys::RunSignalHandlers() /home/runner/work/clangd/clangd/llvm-project/llvm/lib/Support/Signals.cpp:104:18
 #<!-- -->2 0x000000000052eee6 SignalHandler(int) /home/runner/work/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #<!-- -->3 0x00007f5d054f18a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
 #<!-- -->4 0x0000000000a4fe8e clang::StringLiteralParser::init(llvm::ArrayRef&lt;clang::Token&gt;) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Lex/LiteralSupport.cpp:2099:24
 #<!-- -->5 0x0000000000ed077e clang::Sema::ActOnStringLiteral(llvm::ArrayRef&lt;clang::Token&gt;, clang::Scope*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Sema/SemaExpr.cpp:1861:23
 #<!-- -->6 0x0000000001dd9e1f clang::Parser::ParseStringLiteralExpression(bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:3218:18
 #<!-- -->7 0x0000000001dd2244 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:1291:11
 #<!-- -->8 0x0000000001dcf751 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:681:20
 #<!-- -->9 0x0000000001dcdf2c clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:176:10
#<!-- -->10 0x0000000001ddd2ba clang::Parser::ParseExpressionList(llvm::SmallVectorImpl&lt;clang::Expr*&gt;&amp;, llvm::SmallVectorImpl&lt;clang::SourceLocation&gt;&amp;, llvm::function_ref&lt;void ()&gt;, bool, bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:0:0
#<!-- -->11 0x0000000001dd0656 clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult&lt;clang::Expr*, true&gt;) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:2058:15
#<!-- -->12 0x0000000001dd1e22 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, bool&amp;, clang::Parser::TypeCastState, bool, bool*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:1819:9
#<!-- -->13 0x0000000001dcf751 clang::Parser::ParseCastExpression(clang::Parser::CastParseKind, bool, clang::Parser::TypeCastState, bool, bool*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:681:20
#<!-- -->14 0x0000000001dcdf2c clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:176:10
#<!-- -->15 0x0000000001dcde69 clang::Parser::ParseExpression(clang::Parser::TypeCastState) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseExpr.cpp:125:10
#<!-- -->16 0x0000000001e30ce5 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:509:19
#<!-- -->17 0x0000000001e2f34f clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:264:12
#<!-- -->18 0x0000000001e2ec66 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:114:20
#<!-- -->19 0x0000000001e37b81 clang::Parser::ParseCompoundStatementBody(bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:1157:11
#<!-- -->20 0x0000000001e2f674 ParseCompoundStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:966:10
#<!-- -->21 0x0000000001e2f674 ParseCompoundStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:931:10
#<!-- -->22 0x0000000001e2f674 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:279:12
#<!-- -->23 0x0000000001e2ec66 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:114:20
#<!-- -->24 0x0000000001e324aa ParseStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:41:11
#<!-- -->25 0x0000000001e324aa clang::Parser::ParseIfStatement(clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:1522:16
#<!-- -->26 0x0000000001e2f81e clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:286:12
#<!-- -->27 0x0000000001e2ec66 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:114:20
#<!-- -->28 0x0000000001e37b81 clang::Parser::ParseCompoundStatementBody(bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:1157:11
#<!-- -->29 0x0000000001e2f674 ParseCompoundStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:966:10
#<!-- -->30 0x0000000001e2f674 ParseCompoundStatement /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:931:10
#<!-- -->31 0x0000000001e2f674 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&amp;, clang::ParsedAttributes&amp;) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:279:12
#<!-- -->32 0x0000000001e2ec66 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector&lt;clang::Stmt*, 32u&gt;&amp;, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:114:20
#<!-- -->33 0x0000000001e37b81 clang::Parser::ParseCompoundStatementBody(bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:1157:11
#<!-- -->34 0x0000000001e390ad clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&amp;) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseStmt.cpp:2428:21
#<!-- -->35 0x0000000001d86569 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&amp;, clang::Parser::ParsedTemplateInfo const&amp;, clang::Parser::LateParsedAttrList*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:0:0
#<!-- -->36 0x0000000001da3980 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&amp;, clang::DeclaratorContext, clang::ParsedAttributes&amp;, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseDecl.cpp:2121:18
#<!-- -->37 0x0000000001d853a2 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&amp;, clang::ParsingDeclSpec&amp;, clang::AccessSpecifier) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:1179:10
#<!-- -->38 0x0000000001d84de0 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:1193:12
#<!-- -->39 0x0000000001d83fd0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&amp;, clang::ParsingDeclSpec*) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:1019:12
#<!-- -->40 0x0000000001d81adc clang::Parser::ParseTopLevelDecl(clang::OpaquePtr&lt;clang::DeclGroupRef&gt;&amp;, clang::Sema::ModuleImportState&amp;) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:737:10
#<!-- -->41 0x0000000001d7d58e clang::ParseAST(clang::Sema&amp;, bool, bool) /home/runner/work/clangd/clangd/llvm-project/clang/lib/Parse/ParseAST.cpp:161:5
#<!-- -->42 0x0000000001b9219b clang::FrontendAction::Execute() /home/runner/work/clangd/clangd/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1041:10
#<!-- -->43 0x00000000014cc747 operator bool /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/Support/Error.h:235:21
#<!-- -->44 0x00000000014cc747 clang::clangd::BackgroundIndex::index(clang::tooling::CompileCommand) /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:322:19
#<!-- -->45 0x00000000014cf447 _M_data /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:187:28
#<!-- -->46 0x00000000014cf447 _M_is_local /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:222:16
#<!-- -->47 0x00000000014cf447 _M_dispose /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:231:7
#<!-- -->48 0x00000000014cf447 ~basic_string /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/basic_string.h:658:9
#<!-- -->49 0x00000000014cf447 ~CompileCommand /home/runner/work/clangd/clangd/llvm-project/clang/include/clang/Tooling/CompilationDatabase.h:44:8
#<!-- -->50 0x00000000014cf447 operator() /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:165:22
#<!-- -->51 0x00000000014cf447 __invoke_impl&lt;void, (lambda at /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:158:27) &amp;&gt; /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
#<!-- -->52 0x00000000014cf447 __invoke_r&lt;void, (lambda at /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:158:27) &amp;&gt; /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:153:7
#<!-- -->53 0x00000000014cf447 std::_Function_handler&lt;void (), clang::clangd::BackgroundIndex::indexFileTask(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;)::$_3&gt;::_M_invoke(std::_Any_data const&amp;) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
#<!-- -->54 0x00000000014d30ff clang::clangd::BackgroundQueue::work(std::function&lt;void ()&gt;) /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/BackgroundQueue.cpp:43:25
#<!-- -->55 0x00000000014cddf2 ~_Function_base /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:244:11
#<!-- -->56 0x00000000014cddf2 operator() /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:111:27
#<!-- -->57 0x00000000014cddf2 void llvm::detail::UniqueFunctionBase&lt;void&gt;::CallImpl&lt;clang::clangd::BackgroundIndex::BackgroundIndex(clang::clangd::ThreadsafeFS const&amp;, clang::clangd::GlobalCompilationDatabase const&amp;, llvm::unique_function&lt;clang::clangd::BackgroundIndexStorage* (llvm::StringRef)&gt;, clang::clangd::BackgroundIndex::Options)::$_1&gt;(void*) /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
#<!-- -->58 0x0000000001564cb1 PointerIntPair /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:49:12
#<!-- -->59 0x0000000001564cb1 UniqueFunctionBase /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:340:3
#<!-- -->60 0x0000000001564cb1 unique_function /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:369:3
#<!-- -->61 0x0000000001564cb1 operator() /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:102:14
#<!-- -->62 0x0000000001564cb1 Apply&lt;(lambda at /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:97:15)&gt; /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:5
#<!-- -->63 0x0000000001564cb1 GenericThreadProxy&lt;std::tuple&lt;(lambda at /home/runner/work/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:97:15)&gt; &gt; /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:50:5
#<!-- -->64 0x0000000001564cb1 void* llvm::thread::ThreadProxy&lt;std::tuple&lt;clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&amp;, llvm::unique_function&lt;void ()&gt;)::$_1&gt; &gt;(void*) /home/runner/work/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:60:5
#<!-- -->65 0x00007f5d054e66db start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76db)
#<!-- -->66 0x00007f5d04a65a3f clone /build/glibc-2ORdQG/glibc-2.27/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97:0

@Neojan Neojan changed the title [Crush] clangd crush If there is an "N" in the code [Crash] clangd crash If there is an "N" in the code Mar 6, 2024
@zyn0217
Copy link
Contributor

zyn0217 commented Mar 6, 2024

The stacktrace looks more like a clang issue to me.

And yes, I can reproduce it on clang-15: https://gcc.godbolt.org/z/6x3vabWj1

@cor3ntin
Copy link
Contributor

cor3ntin commented Mar 6, 2024

Fixed in clang 16

@cor3ntin cor3ntin closed this as completed Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

5 participants