]>
Commit | Line | Data |
---|---|---|
f0500db3 MS |
1 | /* PR tree-optimization/97027 - missing warning on buffer overflow storing |
2 | a larger scalar into a smaller array | |
3 | Verify overflow by vector stores. | |
4 | { dg-do compile } | |
5 | { dg-options "-O3" } */ | |
6 | ||
7 | void* nowarn_loop (void) | |
8 | { | |
9 | char *p = __builtin_malloc (16); | |
10 | for (int i = 0; i != 16; ++i) | |
11 | p[i] = i; | |
12 | return p; | |
13 | } | |
14 | ||
15 | void* warn_loop (void) | |
16 | { | |
17 | char *p = __builtin_malloc (15); | |
18 | for (int i = 0; i != 16; ++i) | |
94ba897b | 19 | /* The size of the write below depends on the target. When vectorized |
6e6bf4cd | 20 | the vector size may be 4, 8 or 16, otherwise it may be a series of byte |
94ba897b | 21 | assignments. */ |
6e6bf4cd | 22 | p[i] = i; // { dg-warning "writing (1|2|4|8|16) bytes? into a region of size (0|1|3|7|15)" } |
f0500db3 MS |
23 | return p; |
24 | } |