OSDN Git Service

PR rtl-optimization/52139
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / pr19831-1.c
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-optimized" } */
3
4 void test1(void)
5 {
6   int *p = __builtin_malloc (sizeof (int) * 4);
7   int *q = p;
8   *q++ = 4;
9   *q++ = 4;
10   __builtin_free (p);
11 }
12
13 void test3(int b)
14 {
15   int *p = __builtin_malloc (sizeof (int) * 4);
16   if (b)
17     __builtin_free (p);
18   *p = 5;
19 }
20
21 void test4(int b)
22 {
23   int *p = __builtin_malloc (sizeof (int) * 4);
24   if (b)
25     __builtin_free (p);
26   *p = 5;
27   __builtin_free (p);
28 }
29
30 /* { dg-final { scan-tree-dump-times "free" 0 "optimized" } } */
31 /* { dg-final { scan-tree-dump-times "malloc" 0 "optimized" } } */
32 /* { dg-final { cleanup-tree-dump "optimized" } } */