https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97440

            Bug ID: 97440
           Summary: aarch64: Wrong code with -Os -fmodulo-sched -fno-dce
                    -fno-strict-aliasing
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

Created attachment 49376
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49376&action=edit
working assembly at r7-1512

AArch64 GCC miscompiles the following testcase:

static int a, b, c;
int *d = &c;
int **e = &d;
int ***f = &e;
int main()
{
  int h;
  for (a = 2; a; a--)
    for (h = 0; h <= 2; h++)
      for (b = 0; b <= 2; b++)
        ***f = 6;

  if (b != 3)
    __builtin_abort();
}

with -Os -fmodulo-sched -fno-dce -fno-strict-aliasing since
r7-1513-g1dc8d15bc6d7d55c7731093e0a8f280fc5477381.

The issue goes away if any one of these options are removed.

Reply via email to