delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2011/06/30/17:05:07

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type:content-transfer-encoding;
bh=qi45hqy3x3hcJv06AdbpGvsDb09ZIxdDF13wTvJzJGE=;
b=fCwaFReR971BQlXleFugxukHKlFxdYKanuQKr7IaPnYmq3mTXQDBnTQP2nN8QJDR4y
YYHSuu8X3GAZZDzdMca5hzIYa3xVUEcu0xtNw8BrXUJVlS8W0CuJmawGxM2cA5z/Z8cj
tFrE/Q4cwS3stn9mgiQKVS6NrLTwP3jIkz6fE=
MIME-Version: 1.0
In-Reply-To: <201106302255.35497.juan.guerrero@gmx.de>
References: <BANLkTinj8niun3H0Z6QTTsfQZ=8jD1rcSg AT mail DOT gmail DOT com>
<201106302109 DOT 30225 DOT juan DOT guerrero AT gmx DOT de>
<BANLkTin5NAdHrp9N1RkhZ_HosJjWLxdW_g AT mail DOT gmail DOT com>
<201106302255 DOT 35497 DOT juan DOT guerrero AT gmx DOT de>
Date: Fri, 1 Jul 2011 00:04:52 +0300
Message-ID: <BANLkTimsNAHxZRgke1FGchREKr6Fr-Uz=Q@mail.gmail.com>
Subject: Re: [patch] fix epunzip stric aliasing warnings
From: Ozkan Sezer <sezeroz AT gmail DOT com>
To: djgpp-workers AT delorie DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id p5UL506J010013
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, Jun 30, 2011 at 11:55 PM, Juan Manuel Guerrero
<juan DOT guerrero AT gmx DOT de> wrote:
> Am Donnerstag, 30. Juni 2011 schrieb Ozkan Sezer:
> [snip]
>> >        * src/utils/djtar/epunzip.c (epunzip_read): Fix strict aaliasing warning.
>> >        From Ozkan Sezer <sezeroz AT gmail DOT com>
>> >
>>
>> 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
>

Hah!  Baffled..  Anyways, I'm perfectly OK with your changes.

--
O.S.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019