aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr93381.c
blob: cec4b5d8daa4f9924e5bba03ac116dc3e7cfd65d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* { dg-do run } */

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;
}