]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.dg/warn/Warray-bounds-17.C
Correct handling of variable offset minus constant in -Warray-bounds [PR100137]
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / warn / Warray-bounds-17.C
1 // PR middle-end/99109
2 // { dg-do compile }
3 // { dg-options "-O2 -Warray-bounds" }
4
5 typedef int A __attribute__((aligned (64)));
6 void foo (int *);
7
8 void
9 bar (void)
10 {
11 A b; // { dg-message "at offset -\\d into object 'b' of size 4" "note" }
12 int *p = &b;
13 int *x = (p - 1); // { dg-warning "outside array bounds" }
14 foo (x);
15 }