-
Couldn't load subscription status.
- Fork 15k
Open
Labels
clangdcrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
Hi all, I've hit a clangd parsing error which resulted in a crash (segfault?).
Here is the error message:
[ERROR][2025-09-10 17:08:24] ...p/_transport.lua:36 "rpc" "clangd" "stderr" "I[17:08:24.078] clangd version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)\nI[17:08:24.078] Features: linux+grpc\nI[17:08:24.078] PID: 115544\nI[17:08:24.078] Working directory: ~/repos/XBSF\nI[17:08:24.078] argv[0]: clangd\nI[17:08:24.078] argv[1]: --background-index\nI[17:08:24.078] argv[2]: --clang-tidy\nI[17:08:24.078] argv[3]: --header-insertion=iwyu\nI[17:08:24.078] argv[4]: --completion-style=detailed\nI[17:08:24.078] argv[5]: --function-arg-placeholders\nI[17:08:24.078] argv[6]: --fallback-style=llvm\nE[17:08:24.078] Value specified by --function-arg-placeholders is invalid. Provide a boolean value or leave unspecified to use ArgumentListsPolicy from config instead.\nI[17:08:24.078] Starting LSP over stdin/stdout\nI[17:08:24.078] <-- initialize(1)\nI[17:08:24.080] --> reply:initialize(1) 1 ms\n"
[...]
[ERROR][2025-09-10 17:08:37] ...p/_transport.lua:36 "rpc" "clangd" "stderr" "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.\n
Stack dump:
0.\t~/repos/XBSF/xbsf/renderer/api.c:68:5 <Spelling=~/repos/XBSF/xbsf/renderer/../util/string.h:34:46>: current parser token ')'
1.\t~/repos/XBSF/xbsf/renderer/api.c:64:1: parsing function body '_api_create_pipeline'
2.\t~/repos/XBSF/xbsf/renderer/api.c:64:1: in compound statement ('{}')
3.\t~/repos/XBSF/xbsf/renderer/api.c:68:5 <Spelling=~/repos/XBSF/xbsf/renderer/../util/string.h:33:8>: in compound statement ('{}')"
A MRE which resembles the lines reported in the error message is of the like:
#include <string.h>
#define STRING_APPEND(strptr, str) \
do { \
strcpy((strptr + strlen(strptr)), str); \
strptr[strlen(strptr)] = '\0'; \
} while (0)
#define _SHADERS_ROOT_DIR_POSTFIX "/xbsf/renderer/shaders/"
int main(void)
{
char vert_full_path[256] = {'\0'};
char frag_full_path[256] = {'\0'};
STRING_APPEND(vert_full_path, "");
STRING_APPEND(vert_full_path, _SHADERS_ROOT_DIR_POSTFIX "vert.spv");
STRING_APPEND(frag_full_path, "");
STRING_APPEND(frag_full_path, _SHADERS_ROOT_DIR_POSTFIX "frag.spv");
return 0;
}Platform: Linux, Ubuntu.
The .clangd file:
CompileFlags:
Add: [
-DXBSF_DEBUG,
-DXBSF_ENABLE_GPU,
-DXBSFGPU_CUDA,
-DXBSF_UTIL_STRING_IMPLEMENTATIONS,
-DXBSF_GRAPHICS_USE_GUI,
-I./xbsf,
-I./xbsf/include,
-I./xbsf/gui/include,
-isystem,
./deps/cuda,
-isystem,
./deps/nvrtc,
-std=c11
]
Compiler: gcc-12
EDIT:
For conciseness:
util/string.h:34:46>: current parser token ')'is the closing)of thestrcpycommand within theSTRING_APPENDmacro.api.c:64:1: in compound statement ('{}')is the first column char one line down the opening{for the function body, as in themainfunction in the MRE.util/string.h:33:8>: in compound statement ('{}')"is the next char after the{indo {within theSTRING_APPENDmacro.
Metadata
Metadata
Assignees
Labels
clangdcrashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]