PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / slsr-40.c
blob72726a3aa3bbcd807754e9b8aa44608ba60376ed
1 /* Verify straight-line strength reduction for array
2 subscripting.
4 elems[n-1] is reduced to elems + n * 4 + 0xffffffff * 4, only when
5 pointers are of the same size as that of int (assuming 4 bytes). */
7 /* { dg-do run } */
8 /* { dg-options "-O2" } */
10 struct data
12 unsigned long elms[1];
13 } gData;
15 void __attribute__((noinline))
16 foo (struct data *dst, unsigned int n)
18 dst->elms[n - 1] &= 1;
21 int
22 main ()
24 foo (&gData, 1);
25 return 0;