Avoid expicit builtion list in tree-ssa-dce
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / attr-malloc-4.c
blob1517667dfb21e4fa8fda2a4d0a66bce1ed311d1d
1 /* An example where the deallocator requires non-NULL. */
3 struct foo;
4 extern void foo_release (struct foo *)
5 __attribute__((nonnull));
6 extern struct foo *foo_acquire (void)
7 __attribute__ ((malloc (foo_release)));
9 void test_1 (void)
11 struct foo *p = foo_acquire (); /* { dg-message "this call could return NULL" } */
12 foo_release (p); /* { dg-warning "use of possibly-NULL 'p' where non-null" } */
15 void test_2 (void)
17 struct foo *p = foo_acquire ();
18 if (!p)
19 return;
20 foo_release (p);