Bug 2216978

Summary: [abrt] clang-tools-extra: clang::expandUCNs(): clangd killed by SIGSEGV
Product: [Fedora] Fedora Reporter: Scott Worley <dswbike>
Component: clangAssignee: Tom Stellard <tstellar>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 38CC: airlied, dswbike, jchecahi, kkleine, npopov, sbergman, serge.guelton, siddharth.kde, tbaeder, tstellar, tuliom, zawertun
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/ecb09f7b7ef4953ca31583d36bce22b75c4e485
Whiteboard: abrt_hash:c0c82e71ca0e37de8e20cdbf2477ce0a0792e594;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: proc_pid_status
none
File: maps
none
File: limits
none
File: environ
none
File: open_fds
none
File: mountinfo
none
File: os_info
none
File: cpuinfo
none
File: core_backtrace
none
File: exploitable
none
File: backtrace none

Description Scott Worley 2023-06-23 13:52:37 UTC
Description of problem:
Running emacs + lsp on zephyr rtos code project.
Adding parameters to a C macro and I mistyped: MACRO_NAME(a b, c) and mistyped MACRO_NAME refer to below
Missed the comma after the first parameter.
Abrt reported clangd faulted.
Note, I'm using zephyr Device Tree macros making the parsing more complicated.
static const struct espi_mec5_host_index_config espi_mec5_vw_reg_map[] = {
    DT_FOREACH_CHILD_STATUS_OKAY(DT_PATH(mchp_mec5_espi_vw_map), MEC5_DT_VW_REG_MAP)
};
#define MEC5_DT_VW_REG_MAP(n) \
{
   ..., \
  MEC5_DT_CTVW_IRQ_SEL(n), \
},
#define MEC5_DT_CWVW_IRQ_SEL(n) \
  COND_CODE_1(DT_NODE_HAS_PROP(n, vw_interrupt_sels), \
                                    (MEC5_DT_CTVW_ISEL(n)), (MEC5_DT_CTVW_NO_ISEL))
#define MEC5_DT_CTVW_NO_ISEL(n) \
    .irq_sel = { \
      DT_FOREACH_PROP_ELEM(n, vw_source_names, MEC5_DT_CTVW_ISEL_BY_NAME), \
    }
#define MEC5_CT_CTVW_ISEL_BY_NAME(n prop, idx)

With two levels of DT_FOREACH_... and incorrect names by me, clangd got very upset.

Version-Release number of selected component:
clang-tools-extra-16.0.5-1.fc38

Additional info:
reporter:       libreport-2.17.10
type:           CCpp
reason:         clangd killed by SIGSEGV
journald_cursor: s=dbd31240a7624db5a7563b25e7378010;i=1611d;b=61feae009bf640d0bd815b9a4f3b8537;m=6a191ff7;t=5fecbb3004d44;x=8c22e642e321d716
executable:     /usr/bin/clangd
cmdline:        /usr/bin/clangd --header-insertion-decorators=0
cgroup:         0::/user.slice/user-1000.slice/user/app.slice/app-org.gnome.Terminal.slice/vte-spawn-9aedee34-51ac-4255-a031-6dd0d542f00e.scope
rootdir:        /
uid:            1000
kernel:         6.3.8-200.fc38.x86_64
package:        clang-tools-extra-16.0.5-1.fc38
runlevel:       N 5
dso_list:       /usr/bin/clangd clang-tools-extra-16.0.5-1.fc38.x86_64 (Fedora Project) 1687048504
backtrace_rating: 4
crash_function: clang::expandUCNs

Truncated backtrace:
Thread no. 0 (21 frames)
 #0 clang::expandUCNs at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Lex/LiteralSupport.cpp:333
 #1 clang::NumericLiteralParser::NumericLiteralParser at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Lex/LiteralSupport.cpp:1074
 #2 clang::Sema::ActOnNumericConstant at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Sema/SemaExpr.cpp:3769
 #3 clang::Parser::ParseCastExpression at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/ParseExpr.cpp:992
 #5 clang::Parser::ParseAssignmentExpression at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/ParseExpr.cpp:174
 #6 clang::Parser::ParseInitializer at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/include/clang/Parse/Parser.h:2038
 #7 clang::Parser::ParseInitializerWithPotentialDesignator at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/ParseInit.cpp:396
 #8 clang::Parser::ParseBraceInitializer at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/ParseInit.cpp:495
 #9 clang::Parser::ParseInitializer at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/include/clang/Parse/Parser.h:2039
 #10 clang::Parser::ParseBraceInitializer at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/ParseInit.cpp:497
 #11 clang::Parser::ParseInitializer at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/include/clang/Parse/Parser.h:2039
 #12 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/ParseDecl.cpp:2464
 #13 clang::Parser::ParseDeclGroup at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/ParseDecl.cpp:2196
 #14 clang::Parser::ParseDeclOrFunctionDefInternal at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/Parser.cpp:1211
 #15 clang::Parser::ParseDeclarationOrFunctionDefinition at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/Parser.cpp:1226
 #16 clang::Parser::ParseExternalDeclaration at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/Parser.cpp:1041
 #17 clang::Parser::ParseTopLevelDecl at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/Parser.cpp:743
 #18 clang::ParseAST at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Parse/ParseAST.cpp:162
 #19 clang::FrontendAction::Execute at /usr/src/debug/clang-16.0.5-1.fc38.x86_64/lib/Frontend/FrontendAction.cpp:1058
 #20 clang::clangd::(anonymous namespace)::semaCodeComplete at /builddir/build/BUILD/clang-tools-extra-16.0.5.src/clangd/CodeComplete.cpp:1343
 #21 clang::clangd::signatureHelp at /builddir/build/BUILD/clang-tools-extra-16.0.5.src/clangd/CodeComplete.cpp:2133

Comment 1 Scott Worley 2023-06-23 13:52:41 UTC
Created attachment 1972246 [details]
File: proc_pid_status

Comment 2 Scott Worley 2023-06-23 13:52:43 UTC
Created attachment 1972247 [details]
File: maps

Comment 3 Scott Worley 2023-06-23 13:52:45 UTC
Created attachment 1972248 [details]
File: limits

Comment 4 Scott Worley 2023-06-23 13:52:46 UTC
Created attachment 1972249 [details]
File: environ

Comment 5 Scott Worley 2023-06-23 13:52:49 UTC
Created attachment 1972250 [details]
File: open_fds

Comment 6 Scott Worley 2023-06-23 13:52:51 UTC
Created attachment 1972251 [details]
File: mountinfo

Comment 7 Scott Worley 2023-06-23 13:52:52 UTC
Created attachment 1972252 [details]
File: os_info

Comment 8 Scott Worley 2023-06-23 13:52:54 UTC
Created attachment 1972253 [details]
File: cpuinfo

Comment 9 Scott Worley 2023-06-23 13:52:56 UTC
Created attachment 1972254 [details]
File: core_backtrace

Comment 10 Scott Worley 2023-06-23 13:52:58 UTC
Created attachment 1972255 [details]
File: exploitable

Comment 11 Scott Worley 2023-06-23 13:53:00 UTC
Created attachment 1972256 [details]
File: backtrace