Menu

#3998 FATAL Compiler .. Error ... SDCCgenconstprop.cc line 1402

open
other
5
2026-06-06
2026-06-02
bbbbbr
No

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]);
}

Related

Bugs: #4001

Discussion

  • Philipp Klaus Krause

    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.

     
  • Philipp Klaus Krause

    • status: open --> pending-fixed
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    Fixed in the next branch in [r16574].

     

    Related

    Commit: [r16574]

    • bbbbbr

      bbbbbr - 2026-06-04

      Thank you!

       
  • Philipp Klaus Krause

    Unfortunately, the fix caused a regression in diagnostics: [bugs:#4001].

     

    Related

    Bugs: #4001

    • Philipp Klaus Krause

      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
  • Philipp Klaus Krause

    • status: pending-fixed --> open
     

Log in to post a comment.

Auth0 Logo