1: Sample code that reproduces the problem.
struct incomplete;
struct incomplete object = {0};
2: Exact command used to run SDCC on this sample code
./bin/sdcc -c bug.c
3: SDCC version tested
Git f68fca8a4368ece9fe93b21f2e0341282b104359, SDCC 4.6.3 #0 (Linux).
The crash was reproduced on mcs51-large, ds390, z80, z180, r2k, r4k, sm83, tlcs90, hc08, s08, mos6502, huc6280, stm8, and f8. The tested mcs51, mcs51-stack-auto, pdk13, pdk14, and pdk15 configurations instead issue warning 147 and error 66 without crashing.
4: Copy of the error message or incorrect output, or a clear description of the observed versus expected behavior.
On the affected ports, SDCC emits warning 147, excess elements in struct initializer after 'object', and then terminates with:
Caught signal 11: SIGSEGV
N3886 6.7.11p4 requires the entity to be initialized to have complete object type. Warning 147 is a diagnostic, so the defect reported here is the subsequent compiler crash.
Clang 18.1.3, GCC 13.3.0, and TCC 0.9.28rc (mob 9db1105, 2026-09-26) diagnose the invalid definition without crashing.
Attaching a candidate patch to fix this bug.
This is one of eight independent patches against SDCC commit
c8cee3a5b4656a3d7ef97ef6078c38a016a02cfb(2026-09-28).The patches were also applied together to the baseline commit and built with the PIC14 and PIC16 ports disabled. The full device library build completed successfully. Focused valdiag testing of the eight new files passed on all 19 valdiag targets: 27 checks per target, zero failures.
make -C support/regression -j2 test-ucz80:Last edit: Christopher Bazley 2026-09-29
Diff:
Thanks. Fixed via your patch in [r16941].
Related
Commit: [r16941]