------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-18
00:38 -------
(In reply to comment #6)
> Andrew, your testcase is invalid. You cannot access a variable of long type
> through a pointer to int. I know the original code disables strict aliasing,
> but I did not test if your testcase also aborts with -fno-strict-aliasing.
Oops, here is one which is just changes the cast to long* instead of int*,
it is still broken at -O1 -fno-tree-lrs also:
long fff[10];
long f(long a, long b)
{
long crcc = b;
long d = *((long*)(a+1));
int i;
a = d >= b? d:b;
for(i=0;i<10;i++)
fff[i] = a;
}
int main(void)
{
int i;
long a = 10;
f((long)(&a)-1,0);
for(i = 0;i<10;i++)
if (fff[i]!=10)
abort ();
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18548