Let tree_single_nonzero_warnv_p use range information
[official-gcc.git] / gcc / testsuite / gcc.dg / pr41935.c
blobe6a1b28670ac68c3110b8b6cf394269fc829e584
1 /* PR middle-end/41935 */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
5 extern void abort (void);
6 struct A { int a; int b[10]; };
8 int
9 foo (struct A *p)
11 return __builtin_offsetof (struct A, b[p->a]);
14 int
15 main ()
17 struct A a;
18 a.a = 7;
19 if (foo (&a) != 7 * sizeof (int) + __builtin_offsetof (struct A, b))
20 abort ();
21 a.a = 2;
22 if (foo (&a) != 2 * sizeof (int) + __builtin_offsetof (struct A, b))
23 abort ();
24 return 0;