[patch] for PR 17531

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Tue Sep 28 01:29:00 GMT 2004


Hello,

> On Tue, Sep 28, 2004 at 01:05:06AM +0200, Zdenek Dvorak wrote:
> > > is reversed, or there's some later substitution of utype for ctype.
> > > In either case, UTYPE doesn't have enough precision to compute CTYPE,
> > > and thus *any* answer you give is incorrect.
> > 
> > this is because you read it wrong.  You need to express USE using CAND,
> > therefore this test is correct -- you need type of CAND (ctype) to be
> > at least as wide as the type of USE (utype), so that you have enough
> > information.
> 
> In which case, the clause "or there's some later substitution of
> utype for ctype" applies.
> 
> Dude!  Think for one second!

is it really necessary to use this tone?  I spent a second thinking and
observed that if you were right, the optimization would either not work
at all or consistently cause misscompilations on LP64 platforms.  Which
it does not.

> How can it possibly be correct to be
> wanting to compute "(short) &a" in the context of an IV?  Something
> must be broken somewhere!

short a[100];
short b;

for (b = 0; b < 100; b++)
  a[b] = 2 * b;

to

short a[100];
short *p;

for (p = &a; p < &a + 200B; p += 2B)
  *p = (short) (p - &a);

is perfectly valid.

Zdenek



More information about the Gcc-patches mailing list