This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/18548] [4.0 Regression] Miscompiles code generated by Gambit-C Scheme->C compiler


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]