This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c/7284: incorrectly simplifies leftshift followed by signed power-of-2 division
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 12 Jul 2002 17:06:01 -0000
- Subject: Re: c/7284: incorrectly simplifies leftshift followed by signed power-of-2 division
- Reply-to: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
The following reply was made to PR c/7284; it has been noted by GNATS.
From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: "Al Grant" <AlGrant@myrealbox.com>
Cc: nathan@gcc.gnu.org, algrant@acm.org, gcc-bugs@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: c/7284: incorrectly simplifies leftshift followed by signed power-of-2 division
Date: 12 Jul 2002 19:01:43 +0200
"Al Grant" <AlGrant@myrealbox.com> writes:
> 3.3.7 (something else in ISO, maybe 6.3.7)
>
> The result of E1 << E2 is E1 left-shifted E2 bit
> positions; vacated bits are filled with zeros.
>
> For signed types it says nothing more.
>
> Now if signed left-shift is defined at all, in terms of the
> representation, I don't see there's any lack of definition in
> "0x00000080 left-shifted 24 bit positions", it is clearly 0x80000000
> (of the same type). So it's defined unless the standard says
> otherwise, which only C99 seems to.
Defect Report #081 seems to be of interest here
(http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_081.html). It
basically states that the behaviour is implementation defined (for any
signed left shift, not just this case).
--
Falk