152
|
1 /* PR tree-optimization/93582 */
|
|
2 /* { dg-do compile } */
|
|
3 /* { dg-options "-O2 -Warray-bounds" } */
|
|
4
|
|
5 struct S {
|
|
6 unsigned int s1:1;
|
|
7 unsigned int s2:1;
|
|
8 unsigned int s3:1;
|
|
9 unsigned int s4:1;
|
|
10 unsigned int s5:4;
|
|
11 unsigned char s6;
|
|
12 unsigned short s7;
|
|
13 unsigned short s8;
|
|
14 };
|
|
15 struct T {
|
|
16 int t1;
|
|
17 int t2;
|
|
18 };
|
|
19
|
|
20 static inline int
|
|
21 bar (struct S *x)
|
|
22 {
|
|
23 if (x->s4)
|
|
24 return ((struct T *)(x + 1))->t1 + ((struct T *)(x + 1))->t2; /* { dg-bogus "array subscript 1 is outside array bounds of" } */
|
|
25 else
|
|
26 return 0;
|
|
27 }
|
|
28
|
|
29 int
|
|
30 foo (int x, int y)
|
|
31 {
|
|
32 struct S s; /* { dg-bogus "while referencing" } */
|
|
33 s.s6 = x;
|
|
34 s.s7 = y & 0x1FFF;
|
|
35 s.s4 = 0;
|
|
36 return bar (&s);
|
|
37 }
|
|
38
|
|
39 static inline int
|
|
40 qux (struct S *x)
|
|
41 {
|
|
42 int s4 = x->s4;
|
|
43 if (s4)
|
|
44 return ((struct T *)(x + 1))->t1 + ((struct T *)(x + 1))->t2;
|
|
45 else
|
|
46 return 0;
|
|
47 }
|
|
48
|
|
49 int
|
|
50 baz (int x, int y)
|
|
51 {
|
|
52 struct S s;
|
|
53 s.s6 = x;
|
|
54 s.s7 = y & 0x1FFF;
|
|
55 s.s4 = 0;
|
|
56 return qux (&s);
|
|
57 }
|