[hatari-devel] gcc warnings during compilation
Vincent Rivière
vincent.riviere at freesbee.fr
Tue Mar 16 16:14:11 CET 2010
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.
However, it seems there are several GCC bugs related to this warning.
Especially this report, fixed in future version 4.5:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36902
--
Vincent Rivière
More information about the hatari-devel
mailing list