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

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Dec 18 00:03:00 GMT 2004


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-18 00:02 -------
Here is at least a testcase for the MAX_EXPR problem:
Compile with -O0, works, compiling with -O2  -fno-tree-lrs does not.

long fff[10];
long f(long a, long b)
{
  long crcc = b;
  long d = *((int*)(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 ();
}



 -fno-tree-lrs is needed so we don't split the live range of a which we need to do so we hit the bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-12-18 00:02:55
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18548



More information about the Gcc-bugs mailing list