This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/18548] [4.0 Regression] Miscompiles code generated by Gambit-C Scheme->C compiler
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Dec 2004 00:38:50 -0000
- Subject: [Bug middle-end/18548] [4.0 Regression] Miscompiles code generated by Gambit-C Scheme->C compiler
- References: <20041118185317.18548.lucier@math.purdue.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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