This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/7799: [3.2/3.3 regression] Loop bug with optimization flag -Os in gcc
- From: "Christian Ehrhardt" <ehrhardt at mathematik dot uni-ulm dot de>
- To: Segher Boessenkool <segher at koffie dot nl>
- Cc: nejataydin at superonline dot com, gcc-gnats at gcc dot gnu dot org, gcc at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: Fri, 20 Dec 2002 10:23:56 +0100
- Subject: Re: optimization/7799: [3.2/3.3 regression] Loop bug with optimization flag -Os in gcc
- References: <20021213133626.29733.qmail@theseus.mathematik.uni-ulm.de> <3E01F4EA.7593382F@koffie.nl>
On Thu, Dec 19, 2002 at 05:33:49PM +0100, Segher Boessenkool wrote:
> > This transformation is IMHO illegal because there is no way to make the
> > comparison in general equivialent to that in the original for loop.
> > If p is initially 0x7ffffffc the comparison must be treated as unsigned,
> > however, if p is initially 0xfffffffc the comparison must be treated as
> > signed.
>
> >From C99 final draft (I wish I had the final version of the standard):
> > [ arrays can't wrap around address 0 ]
Thanks. Others pointed this out as well.
> The comparison should always be unsigned; I don't remember the x86 ISA well
> enough to know if jle is unsigned, but I believe so.
That's the point: jle is signed. jbe is unsigned. The signedness of the
comparison is derived from the type of i which is wrong after elimination
of the loop variable.
regards Christian
--
THAT'S ALL FOLKS!