]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.dg/warn/Wuse-after-free4.C
Constrain PHI handling in -Wuse-after-free [PR104232].
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / warn / Wuse-after-free4.C
1 /* PR middle-end/104232 - spurious -Wuse-after-free after conditional free
2 { dg-do compile }
3 { dg-options "-O2 -Wall" } */
4
5 char* f (void);
6
7 struct A
8 {
9 char *p;
10 A (): p () { }
11 ~A ()
12 {
13 __builtin_free (p); // { dg-bogus "-Wuse-after-free" }
14 }
15 };
16
17 int test_no_warn (void)
18 {
19 A px, qx;
20
21 qx.p = f ();
22 if (!qx.p)
23 return 0;
24
25 px.p = f ();
26 return 1;
27 }