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

            Bug ID: 127515
           Summary: ivopts miscompiles loop
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kristerw at gcc dot gnu.org
            Blocks: 118443
  Target Milestone: ---

The test below fails when compiled for for x86_64 with -O1:

#include <stdint.h>

uintptr_t sum = 0;

__attribute__((noipa)) void
f (char *p, unsigned int i, unsigned int n)
{
  p -= i;
  do
    {
      sum += (uintptr_t)p;
      p -= 1;
      i++;
    }
  while (i < n);
}

int
main ()
{
  f ((char *)0x10000ffffffff, -1, 1);
  if (sum != (uintptr_t)0x1ffffffffffff)
    __builtin_abort ();
  return 0;
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing

Reply via email to