aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/builtin-free.c
blob: 67dd071406d329c514ff18cf8c5d564a0190a69d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

void bar (void *);
void foo(unsigned n)
{
  void *p = __builtin_malloc (n);
  if (p)
    {
      bar (p);
      __builtin_free (p);
      p = 0;
    }
  __builtin_free (p);
}

/* We should remove the redundant call to free.  */

/* { dg-final { scan-tree-dump-times "free" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */