[hatari-devel] gcc warnings during compilation

Thomas Huth huth at users.berlios.de
Tue Mar 16 19:26:38 CET 2010


On Tue, 16 Mar 2010 16:14:11 +0100
Vincent Rivière <vincent.riviere at freesbee.fr> wrote:

> npomarede at corp.free.fr wrote:
> > src/falcon/dsp_cpu.c: In function 'dsp_jsset_pp':
> > src/falcon/dsp_cpu.c:909: attention : array subscript is above
> > array bounds
> >
> > This seems caused by
> > addr = 0xffc0 + value;
> > value = read_memory(memspace, addr);
> >
> > which puts addr in the range 0xffc0 - 0xffff, but as read_memory
> > defines rom as [][0x200], gcc notices value will be out of range
> > because it doesn't know there's a case for < 0x200 and > 0xffc0
> > (but in the case of line 909, we know address < 0x200, so this
> > looks like a gcc error).
> 
> Beware, when you compile with -O3 GCC does as much inlining as
> possible, and normally this warning occurs when GCC is really
> generating some useful code to access an array out of range.

I've had a look at the source code already twice, and as far as I could
tell, it is a compiler bug in our case. I don't see a possibility how
the code could really access the space outside of the array here...

 Regards,
  Thomas



More information about the hatari-devel mailing list