Execution of gcc.c-torture/execute/20050713-1.c fails on r7000 with -O2 and
-Os,
but passes with -O0, -O1, -O3 or when --fno-optimize-sibling-calls is added
to -O2 or -Os.

A simpler version of the test that reproduces the error is:

extern void abort (void);

struct S
{
  int a, b, c;
};

int
foo2 (struct S x, struct S y)
{
    if (y.a != 6) abort (); 
  return 0;
}

int
foo3 (struct S x, struct S y, struct S z)
{
  foo2 (x, y);
  return 0;
}

int
baz3 (struct S x, struct S y, struct S z)
{
  return foo3 (y, z, x);
}

int
main (void)
{
  struct S a = { 3, 4, 5 }, b = { 6, 7, 8 }, c = { 9, 10, 11 };
  baz3 (c, a, b);
  return 0;
}


-- 
           Summary: mips64: wrong code for gcc.c-torture/execute/20050713-
                    1.c with -O2 or -Os
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: niva at niisi dot msk dot ru
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: mips64-none-elf


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

Reply via email to