[hatari-devel] gcc warnings during compilation

npomarede at corp.free.fr npomarede at corp.free.fr
Sat Mar 13 17:32:18 CET 2010


Hello,

I get a few warnings during compilation :

src/control.c: In function 'Control_SetSocket':
src/control.c:438: attention : passing argument 2 of 'connect' from incompatible pointer type
/usr/include/sys/socket.h:129: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'

eero, I think a cast should be added there ?


I also get this :

src/falcon/dsp_cpu.c: In function 'dsp_jsset_pp':
src/falcon/dsp_cpu.c:909: attention : array subscript is above array bounds
src/falcon/dsp_cpu.c: In function 'dsp_jsclr_pp':
src/falcon/dsp_cpu.c:909: attention : array subscript is above array bounds
src/falcon/dsp_cpu.c: In function 'dsp_btst_pp':
src/falcon/dsp_cpu.c:909: attention : array subscript is above array bounds
src/falcon/dsp_cpu.c: In function 'dsp_jset_pp':
src/falcon/dsp_cpu.c:909: attention : array subscript is above array bounds
src/falcon/dsp_cpu.c: In function 'dsp_jclr_pp':
src/falcon/dsp_cpu.c:909: attention : array subscript is above array bounds
src/falcon/dsp_cpu.c: In function 'dsp_bchg_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).

Any idea on how to remove these (harmless) warnings ?

I'm compiling with : -Wall -Wwrite-strings -Wsign-compare 
-Wmissing-prototypes -Wstrict-prototypes -Wcast-qual -Wbad-function-cast 
-Wpointer-arith  -O3


Nicolas



More information about the hatari-devel mailing list