1 /* PR tree-optimization/82596 - missing -Warray-bounds on an out-of-bounds
2 index into string literal
4 { dg-options "-O2 -Warray-bounds" } */
6 #define SIZE_MAX __SIZE_MAX__
7 #define SSIZE_MAX __PTRDIFF_MAX__
8 #define SSIZE_MIN (-SSIZE_MAX - 1)
12 #define T(arg) sink (arg)
14 void test_cststring (int i
)
16 T (""[SSIZE_MIN
]); /* { dg-warning "below array bounds" "string" { xfail lp64 } } */
17 T (""[SSIZE_MIN
+ 1]); /* { dg-warning "below array bounds" "string" } */
18 T (""[-1]); /* { dg-warning "below array bounds" "string" } */
20 T (""[1]); /* { dg-warning "above array bounds" "string" } */
21 T ("0"[2]); /* { dg-warning "above array bounds" "string" } */
24 T ("012"[4]); /* { dg-warning "above array bounds" "string" } */
25 T ("0123"[SSIZE_MAX
]); /* { dg-warning "above array bounds" "string" } */
26 T ("0123"[SIZE_MAX
]); /* { dg-warning "above array bounds" "string" } */