Menu

#2590 z80: seg fault caused by application of __smallc attribute

closed-fixed
None
Z80
5
2017-03-13
2017-03-01
alvin
No

sdcc -v
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.6.5 #9842 (MINGW32)
published under GNU General Public License (GPL)

Test program:

#define MODE2_ATTR  8192

extern const unsigned char letras_tiles01[208];

extern void msx_vfill(unsigned int addr, unsigned int value, unsigned int count) __smallc;
extern void msx_vwrite_direct(void* source, unsigned int dest, unsigned int count) __smallc;

void poner_texto_tiles(unsigned char *texto, unsigned int size, unsigned int posicion, unsigned char color)
{
      unsigned char i = 0;

      while (size)
      {

            if (texto[i] == ' ')
            {
                  msx_vfill((posicion << 3), 0x00, 8);
                  msx_vfill(MODE2_ATTR + (posicion << 3), color, 8);
            }
            else
            {
                  msx_vwrite_direct(letras_tiles01 + ((*(texto + i) - 65) << 3), posicion << 3, 8);
                  msx_vfill(MODE2_ATTR + (posicion << 3), color, 8);
            }

            i++;
            posicion++;
            size--;
        }
}

sccz80 -mz80 -S test.c
Output is "Caught signal 11: caught SIGSEGV"

I traced this to the msx_vfill() calls in the true part of "if (texto[i] == ' ')". If I comment out this two calls, compilation is successful including the compilation of an identical call to msx_vfill() in the false part of the "if".

I also found that eliminating the smallc attribute on the msx_vfill() prototype leads to successful compilation. This leads to the suspicion that smallc is somehow bugged.

Discussion

  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

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

    Fixed in [r9850].

    Philipp

     

    Last edit: Maarten Brock 2017-04-26

Log in to post a comment.