]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.dg/pr95768.C
Correct handling of variable offset minus constant in -Warray-bounds [PR100137]
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / pr95768.C
1 /* PR c++/95768 - pretty-printer ICE on -Wuninitialized with allocated storage
2 { dg-do compile }
3 { dg-options "-O2 -Wall -Wno-array-bounds" } */
4
5 extern "C" void *malloc (__SIZE_TYPE__);
6
7 struct f
8 {
9 int i;
10 static int e (int);
11 void operator= (int) { e (i); }
12 };
13
14 struct m {
15 int i;
16 f length;
17 };
18
19 struct n {
20 m *o() { return (m *)this; }
21 };
22
23 struct p {
24 n *header;
25 p () {
26 header = (n *)malloc (0);
27 m b = *header->o(); // { dg-warning "\\\[-Wuninitialized" }
28 b.length = 0;
29 }
30 };
31
32 void detach2() { p(); }