summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr45991.c
blob: eefce4429e1b1360729cb424a9358adb64d83743 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-options "-O -fstrict-overflow" } */

struct S
{
  int i;
};

char A[64];

void foo (char **dst, int i)
{
  char *p = A + 16;
  while (i--)
    {
      int b = ((struct S *) (&p[i * 16 + 4]))->i;
      char *c = A + i * 16;
      dst[i] = c + b;
    }
}