I'm not sure if this is a bug or just questionable coding, so I'll ask here before reporting it as a bug. I'm trying to figure out why someone elses code tha works on snaps less than 5559 but not after 5560 is broken (so far without success :-)). While poking at that I came across this change where the same code sometimes gets a warning and sometimes doesn't:
$ cat test4.c #include <w7100.h> typedef unsigned char uint8; typedef volatile unsigned char vuint8; #define COMMON_BASE 0x0000 #define UIPR0 ((volatile __xdata uint8 *)(COMMON_BASE + 0x002A)) // required for IINCHIP_WRITE and IINCHIP_READ port for SDCC to // avoid compiler use of non mapped memory access while banking static __data uint8 w_d; uint8 IINCHIP_READ(__xdata vuint8 *addr) __reentrant __critical { w_d = *((__xdata vuint8 *)(addr)); return w_d; } main() { static __xdata uint8 invalid_ip[4]; invalid_ip[0] = IINCHIP_READ(UIPR0+1); return (0); } This compiler is snap 5559 compiled from source pe...@pc700 ~/wiznet/nos_test $ sdcc -v SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.4 # (Dec 31 2010) (CYGWIN) pe...@pc700 ~/wiznet/nos_test $ /usr/local//bin/sdcc -c test4.c pe...@pc700 ~/wiznet/nos_test $ Note it doesn't complain about the conversion without a cast in the line invalid_ip[0] = IINCHIP_READ(UIPR0+1); where UIPR0 is in fact a pointer to an unsigned char and thus is doing pointer arithmatic (nor am I a good enough C coder to know if it should be complaining or not :-)). nor does a recent 3_0_1 snapshot pe...@pc700 ~/wiznet/nos_test $ "/cygdrive/c/program files/SDCC3_0_1"/bin/sdcc -v SDCC : mcs51/gbz80/z80/ds390/pic16/pic14/TININative/ds400/hc08 3.0.1 #6066 (Nov 26 2010) (MINGW32) pe...@pc700 ~/wiznet/nos_test $ "/cygdrive/c/program files/SDCC3_0_1"/bin/sdcc test4.c pe...@pc700 ~/wiznet/nos_test but snap 5560 (and I think some later ones, I've been binary searching for the failure point through previous snaps :-)) issues a warning about the lack of a cast. This compiler is snap 5560 compiled from source (which also breaks the full code for reasons as yet unknown) which does complain about the lack of a cast. pe...@pc700 ~/wiznet/nos_test $ /usr/local//bin/sdcc -c test4.c test4.c:25: warning 154: converting integral to pointer without a cast from type 'const-unsigned-char literal' to type 'volatile-unsigned-char xdata* auto' pe...@pc700 ~/wiznet/nos_test $ sdcc -v SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.4 # (Dec 30 2010) (CYGWIN) Comments on a reportable bug or operator error in the form of poor coding practice (the original code from Wiznet that this is based on is full of poor coding practices :-))? Peter Van Epp ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user