]>
Commit | Line | Data |
---|---|---|
129ef157 MS |
1 | /* PR tree-optimization/89662- -Warray-bounds ICE on void* arithmetic |
2 | { dg-do compile } | |
a62a1606 | 3 | { dg-require-effective-target alloca } |
129ef157 MS |
4 | { dg-options "-O2 -Wall" } */ |
5 | ||
8e7803e8 | 6 | static void* vptr (void *c) |
129ef157 MS |
7 | { |
8 | return c; | |
9 | } | |
10 | ||
11 | void sink (void*); | |
12 | ||
13 | void test_vptr_arith_vla_cst (void) | |
14 | { | |
15 | int n = 1; | |
16 | char c[n]; | |
17 | sink (vptr (c) - 1); /* { dg-warning "\\\[-Warray-bounds" } */ | |
18 | } | |
19 | ||
20 | void test_vptr_arith_vla_range (int n) | |
21 | { | |
22 | if (n < 1 || 4 < n) | |
23 | return; | |
24 | ||
25 | char c[n]; | |
26 | sink (vptr (c) - 1); /* { dg-warning "\\\[-Warray-bounds" "pr82608" { xfail *-*-* } } */ | |
27 | } | |
28 | ||
29 | void test_vptr_arith_vla_var (int n) | |
30 | { | |
31 | char c[n]; | |
32 | sink (vptr (c) - 1); /* { dg-warning "\\\[-Warray-bounds" "pr82608" { xfail *-*-* } } */ | |
33 | } |