Compiling using gcc 3.4.4 in SPARC Solaris 10

Started by jopython, December 15, 2011, 03:08:41 PM

Previous topic - Next topic

jopython

I get a lot of 'dereferencing type-punned pointer' warnings.



$ make -f makefile_sunos



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS newlisp.c



newlisp.c: In function `p_apply':



newlisp.c:4295: warning: dereferencing type-punned pointer will break strict-aliasing rules



newlisp.c: In function `implicitNrestSlice':



newlisp.c:4967: warning: dereferencing type-punned pointer will break strict-aliasing rules



newlisp.c:4980: warning: dereferencing type-punned pointer will break strict-aliasing rules



newlisp.c: In function `p_mainArgs':



newlisp.c:6657: warning: dereferencing type-punned pointer will break strict-aliasing rules



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-symbol.c



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-math.c



nl-math.c: In function `randomDist':



nl-math.c:1137: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-math.c: In function `p_series':



nl-math.c:1642: warning: dereferencing type-punned pointer will break strict-aliasing rules



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-list.c



nl-list.c: In function `explodeList':



nl-list.c:145: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-list.c: In function `p_lookup':



nl-list.c:579: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-list.c: In function `implicitIndexList':



nl-list.c:1105: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-list.c:1112: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-list.c:1142: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-list.c: In function `implicitIndexArray':



nl-list.c:2007: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-list.c:2014: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-list.c:2028: warning: dereferencing type-punned pointer will break strict-aliasing rules



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-liststr.c



nl-liststr.c: In function `p_chop':



nl-liststr.c:315: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `p_push':



nl-liststr.c:432: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:437: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:497: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `p_pop':



nl-liststr.c:566: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:571: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:592: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `popString':



nl-liststr.c:627: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:630: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `pushOnString':



nl-liststr.c:673: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `p_select':



nl-liststr.c:756: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:760: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:803: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:807: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `p_slice':



nl-liststr.c:837: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c:839: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `p_find':



nl-liststr.c:995: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `p_dup':



nl-liststr.c:1284: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-liststr.c: In function `p_rotate':



nl-liststr.c:1572: warning: dereferencing type-punned pointer will break strict-aliasing rules



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-string.c



nl-string.c: In function `implicitIndexString':



nl-string.c:183: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-string.c: In function `p_char':



nl-string.c:284: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-string.c: In function `p_explode':



nl-string.c:375: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-string.c: In function `p_pack':



nl-string.c:1654: warning: dereferencing type-punned pointer will break strict-aliasing rules



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-filesys.c



nl-filesys.c: In function `p_readBuffer':



nl-filesys.c:256: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c: In function `writeBuffer':



nl-filesys.c:494: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c: In function `p_share':



nl-filesys.c:1881: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c:1889: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c: In function `p_date':



nl-filesys.c:2214: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c: In function `p_now':



nl-filesys.c:2389: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c: In function `p_dateList':



nl-filesys.c:2462: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c:2463: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c: In function `p_dateValue':



nl-filesys.c:2499: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c:2500: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c:2501: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c:2508: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c:2509: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-filesys.c:2510: warning: dereferencing type-punned pointer will break strict-aliasing rules



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-sock.c



nl-sock.c: In function `p_netReceive':



nl-sock.c:877: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-sock.c: In function `p_netReceiveUDP':



nl-sock.c:1020: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-sock.c: In function `p_netReceiveFrom':



nl-sock.c:1052: warning: dereferencing type-punned pointer will break strict-aliasing rules



nl-sock.c: In function `p_netSend':



nl-sock.c:1072: warning: dereferencing type-punned pointer will break strict-aliasing rules



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-import.c



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-xml.c



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-web.c



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-matrix.c



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS nl-debug.c



gcc -m32 -Wall -pedantic -Wno-uninitialized -Wno-long-long -c -O2 -DSUNOS pcre.c



gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o  nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -m32 -lm -ldl -lrt -lsocket -lnsl -o newlisp



 



 



$ gcc -v



Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs



Configured with: /sfw10/builds/build/sfw10-patch/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/ccs/bin/as --without-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared



Thread model: posix



gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

Lutz

#1
Newer gcc versions (4.x +) don't worry about this (at least on Mac OSX and Windows).



ILP32 assumes that int, long, char *, void * all have the same length of 32-bit. The code frequently casts one to the other, but they are all the same size and no aliasing problems will occur. Newer gcc versions recognize this and don't complain.



You could add the '-fno-strict-aliasing'  or -Wno-strict-aliasing to the CFLAGS line in the makfile_sunos, like makefile_opensolaris and many other makefiles in the distribution do it too.



In any case make sure that 'make testall' runs fine.



Also make sure that until/types.c compiled with -m32 produces the following output:


type      bytes
---------------
char      1
char *    4
void *    4
short int 2
int       4
long      4
long int  4
long long 8
float     4
double    8
wchar_t   4
size_t    4
off_t     4
time_t    4