]> git.ipfire.org Git - thirdparty/gcc.git/blame - 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
CommitLineData
abb1b605
MS
1/* PR c++/95768 - pretty-printer ICE on -Wuninitialized with allocated storage
2 { dg-do compile }
a1108556 3 { dg-options "-O2 -Wall -Wno-array-bounds" } */
abb1b605
MS
4
5extern "C" void *malloc (__SIZE_TYPE__);
6
7struct f
8{
9 int i;
10 static int e (int);
11 void operator= (int) { e (i); }
12};
13
14struct m {
15 int i;
16 f length;
17};
18
19struct n {
20 m *o() { return (m *)this; }
21};
22
23struct 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
32void detach2() { p(); }