This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/81815] New: Invalid conditional reduction


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

            Bug ID: 81815
           Summary: Invalid conditional reduction
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rsandifo at gcc dot gnu.org
  Target Milestone: ---

This code is incorrectly treated as a conditional reduction, so fails on
aarch64-linux-gnu at -O3.

int __attribute__ ((noinline, noclone))
f (int *x, int n)
{
  int b = 13;
  for (int i = 0; i < n; ++i)
    {
      int next = x[i];
      b = b < 100 ? next : 200;
    }
  return b;
}

static int res[32];

int
main (void)
{
  for (int i = 0; i < 32; ++i)
    res[i] = i;
  res[15] = 100;
  if (f (res, 32) != 200)
    __builtin_abort ();
  return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]