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

            Bug ID: 93381
           Summary: points-to wrong for integer offsetting and
                    field-sensitive analysis
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

The following aborts at -O2

static struct S { int *p1; int *p2; } s;
typedef __UINTPTR_TYPE__ uintptr_t;
int foo()
{
  int i = 1, j = 2;
  struct S s;
  int **p;
  s.p1 = &i;
  s.p2 = &j;
  p = &s.p1;
  uintptr_t pi = (uintptr_t)p;
  pi = pi + sizeof (int *);
  p = (int **)pi;
  **p = 3;
  return j;
}

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

Reply via email to