X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX1+IY+sAs06Io0ZxWvpf/tJlP4+lbVO9bsmVzL98rV gtgwFXG2aN2YAU From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: Re: [patch] fix epunzip stric aliasing warnings Date: Thu, 30 Jun 2011 22:55:35 +0200 User-Agent: KMail/1.9.10 References: <201106302109 DOT 30225 DOT juan DOT guerrero AT gmx DOT de> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Message-Id: <201106302255.35497.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id p5UL13FL009732 Reply-To: djgpp-workers AT delorie DOT com Am Donnerstag, 30. Juni 2011 schrieb Ozkan Sezer: [snip] > >        * src/utils/djtar/epunzip.c (epunzip_read): Fix strict aaliasing warning. > >        From Ozkan Sezer > > > > Just a note: Replacing (int *) casts onto char buffers by (__dj_int_a *) > is not necessary, as char* is already a may_alias type. > EDIT: Even those (__dj_short_a *) can be simplified into (short *) casts, > which I obviously missed doing in my initial version. In any case, the > result will be just the same but, IMO, the simplified ones will be easier > to read. Attached my 2nd version; pick as you like. The only reason why I changed your patch was that when I compiled with gcc453 I got the following warnings:: C:/DJGPP-2.04/BIN/make.exe -C utils gcc ... -c epunzip.c epunzip.c: In function 'epunzip_read': epunzip.c:161:7: warning: dereferencing type-punned pointer will break strict-aliasing rules epunzip.c:167:7: warning: dereferencing type-punned pointer will break strict-aliasing rules epunzip.c:173:7: warning: dereferencing type-punned pointer will break strict-aliasing rules epunzip.c:179:7: warning: dereferencing type-punned pointer will break strict-aliasing rules epunzip.c:285:8: warning: dereferencing type-punned pointer will break strict-aliasing rules epunzip.c:296:8: warning: dereferencing type-punned pointer will break strict-aliasing rules epunzip.c:302:8: warning: dereferencing type-punned pointer will break strict-aliasing rules epunzip.c:308:8: warning: dereferencing type-punned pointer will break strict-aliasing rules ld -s ../../../lib/crt0.o djtar.o oread.o epunzip.o untar.o unzip.o unlzw.o unlzh.o unpack.o inflate.o crypt.o util.o zmethod.o unbzip2.o bzlib.o decompress.o huffman.o randtable.o crctable.o ../../../lib/libc.a -o ../../../bin/djtar.exe c:/djgpp-2.04/bin/../lib/gcc/djgpp/4.53/libgcc.a -T c:/djgpp-2.04/lib/djgpp.djl ../../../hostbin/stubify.exe ../../../bin/djtar.exe Those warnings made reference to assigments like this one: timedate = *(int *)buffer; so I changed it. IIRC with gcc460 did not issued those warnings!!. Regards, Juan M. Guerrero