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

            Bug ID: 70460
           Summary: [6 Regression] Miscompilation of glibc on i686-linux
                    starting with r234101
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

The following testcase distilled from glibc's vfprintf is miscompiled at -O2
starting with r234101.  It has been reported only on i686, but the testcase
below fails also on x86_64-linux.

int c;

__attribute__((noinline, noclone)) void
foo (int x)
{
  static int b[] = { &&lab1 - &&lab0, &&lab2 - &&lab0 };
  void *a = &&lab0 + b[x];
  goto *a;
lab1:
  c += 2;
lab2:
  c++;
lab0:
  ;
}

int
main ()
{
  foo (0);
  if (c != 3)
    __builtin_abort ();
  foo (1);
  if (c != 4)
    __builtin_abort ();
  return 0;
}

Reply via email to