Menu

#3249 GBZ80 segfault when using initializer for variable in non-intrinsic space

closed-fixed
None
other
5
2023-01-30
2021-06-08
Tony Pavlov
No
volatile char tmp;

void set_RAM_bank1(void) { tmp = 1; }

__addressmod set_RAM_bank1 DATA_1;

DATA_1 int addendum1_ram = 2;

void main() {
  tmp = 0;
}
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/gbz80/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.1.6 #12426 (MINGW64)
sdcc -mgbz80 --fsigned-char --no-std-crt0 -I ..\..\gbdk\include -I ..\..\gbdk\include\asm -I src\include -c --max-allocs-per-node 50000 test
0.c -o build\test0.rel
Caught signal 11: SIGSEGV

i guess that's because it must use old style _GSINIT section for that, not new _INITIALIZER/_INITIALIZED

Related

Wiki: NGI0-Entrust-SDCC

Discussion

  • Philipp Klaus Krause

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

    Fixed in [r13842].

    The underlying issue was a check for the possibility of tail-call optimization in code generation, which assumed that is was generating code for a function (as opposed to the intialization of a file-scope object). Similar issues existed for stm8 and mcs51.

     

    Related

    Commit: [r13842]


Log in to post a comment.