annotate gcc/testsuite/gcc.dg/tree-ssa/pr19831-3.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-O2 -fno-ipa-icf -fdump-tree-optimized" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 void test2(void)
kono
parents:
diff changeset
5 {
kono
parents:
diff changeset
6 int *p = __builtin_malloc (sizeof (int) * 4);
kono
parents:
diff changeset
7 if (p == (void *)0)
kono
parents:
diff changeset
8 __builtin_abort ();
kono
parents:
diff changeset
9 __builtin_free (p);
kono
parents:
diff changeset
10 }
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 void test5(int b)
kono
parents:
diff changeset
13 {
kono
parents:
diff changeset
14 int *p = __builtin_malloc (sizeof (int) * 4);
kono
parents:
diff changeset
15 if (p)
kono
parents:
diff changeset
16 __builtin_free (p);
kono
parents:
diff changeset
17 }
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 void test6(void)
kono
parents:
diff changeset
20 {
kono
parents:
diff changeset
21 int *p = __builtin_malloc (sizeof (int) * 4);
kono
parents:
diff changeset
22 if (p == (void *)0)
kono
parents:
diff changeset
23 __builtin_abort ();
kono
parents:
diff changeset
24 if (p)
kono
parents:
diff changeset
25 __builtin_free (p);
kono
parents:
diff changeset
26 }
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 /* We should be able to remove all malloc/free pairs with CDDCE.
kono
parents:
diff changeset
29 Assume p was non-NULL for test2.
kono
parents:
diff changeset
30 For test5, it doesn't matter if p is NULL or non-NULL. */
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 /* { dg-final { scan-tree-dump-times "free" 0 "optimized" { xfail *-*-* } } } */
kono
parents:
diff changeset
33 /* { dg-final { scan-tree-dump-times "malloc" 0 "optimized" { xfail *-*-* } } } */
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 /* But make sure we don't partially optimize for now. */
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 /* { dg-final { scan-tree-dump-times "free" 3 "optimized" } } */
kono
parents:
diff changeset
38 /* { dg-final { scan-tree-dump-times "malloc" 3 "optimized" } } */