SDCC nightly build with no GBDK patches:
sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/r4k/r5k/r6k/sm83/tlcs90/ez80/z80n/r800/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502/mos65c02/f8/f8l TD- 4.6.0 #16555 (Linux)
Getting the following compiler error:
sdcc_genconstprop_1402_compiler_error.c:10: error 9: FATAL Compiler Internal Error in file 'SDCCgenconstprop.cc' line number '1402' : code generator internal error
Building with:
sdcc -msm83 -c sdcc_genconstprop_1402_compiler_error.c
sdcc -mz80 -c sdcc_genconstprop_1402_compiler_error.c
sdcc -mmos6502 -c sdcc_genconstprop_1402_compiler_error.c
Minimal example to reproduce:
unsigned char loadedCharacters[10];
void my_func_1(unsigned char a);
inline void my_func2(unsigned int a) {
if (a < 256) {
my_func_1((unsigned char)a);
} else {
my_func_1((unsigned char)a);
}
}
void my_func3(void){
my_func2((unsigned int)loadedCharacters[1]);
}
Apparently, the call to computeDataFlow in line 3923 of SDCCopt.c optimizes out an IFX iCode resulting in an unreachable basic block. Much later, that block is the eliminated, but OP_USES for an iTemp still references an iCode in that basic block.
Fixed in the next branch in [r16574].
Related
Commit: [r16574]
Thank you!
Unfortunately, the fix caused a regression in diagnostics: [bugs:#4001].
Related
Bugs: #4001
The change has been reverted in trunk (where next had been merged to after SDCC 4.6.0 RC1). I'll try to come up with a better fix in the next branch.
Last edit: Philipp Klaus Krause 2026-06-06