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



             Bug #: 56965

           Summary: nonoverlapping_component_refs_p is bogus

    Classification: Unclassified

           Product: gcc

           Version: 4.9.0

            Status: UNCONFIRMED

          Keywords: wrong-code

          Severity: normal

          Priority: P3

         Component: rtl-optimization

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: rgue...@gcc.gnu.org





struct S {

    int i;

    int j;

};

struct U {

    struct S s;

} __attribute__((may_alias));

int __attribute__((noinline,noclone))

foo (struct U *p, struct U *q)

{

  int i;

  q->s.j = 1;

  i = p->s.i;

  return i;

}

int main()

{

  int *p = (int *)__builtin_alloca (sizeof (int) * 3);

  p[1] = 0;

  if (foo ((struct U *)(p + 1), (struct U *)p) != 1)

    __builtin_abort ();

  return 0;

}



fails on x86_64 with -O2 -fschedule-insns because scheduling exchanges

the store and the load.

Reply via email to