1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 
4 void bar (void *);
foo(unsigned n)5 void foo(unsigned n)
6 {
7   void *p = __builtin_malloc (n);
8   if (p)
9     {
10       bar (p);
11       __builtin_free (p);
12       p = 0;
13     }
14   __builtin_free (p);
15 }
16 
17 /* We should remove the redundant call to free.  */
18 
19 /* { dg-final { scan-tree-dump-times "free" 1 "optimized" } } */
20