Menu

#3481 Caught signal 11: SIGSEGV

open
nobody
None
Front-end
5
7 hours ago
2022-09-09
Under4Mhz
No

The following code segfaults:

/// GPL 2.0 or later
#include <stdint.h>

uint16_t fast_rand();
void ImageStatusImage( uint8_t health ) {

    uint8_t frame = fast_rand( health ) % 4;
}
 sdcc -mz80 ./segv.c 
./segv.c:4: warning 283: function declarator with no prototype
Caught signal 11: SIGSEGV
sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502 4.2.9 #13696 (Linux)

Discussion

  • Philipp Klaus Krause

    This is a bigger issue than I first thought, and will take a while to fully fix.
    In particular, there are remaining issue wrt. register parameters.
    In [r13701], all issues except for the register parameter one should be fixed, but that one is so serious, that we can't generatecorrect code.
    Some corner cases work now, and for the rest there is now an error message instead of a crash. I'll leave the bug report open until this is fully fixed.

     

    Related

    Commit: [r13701]

  • Gabriele Gorla

    Gabriele Gorla - 7 hours ago

    I tried with latest SVN.
    I get an internal error in all backends.

     
  • Gabriele Gorla

    Gabriele Gorla - 7 hours ago
    • Category: other --> Front-end
     

Log in to post a comment.