annotate gcc/testsuite/gcc.dg/pr79715.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 /* PR tree-optimization/79715 - hand-rolled strdup with unused result
kono
parents:
diff changeset
2 not eliminated
kono
parents:
diff changeset
3 { dg-do compile }
kono
parents:
diff changeset
4 { dg-options "-O2 -Wall -fdump-tree-optimized" } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 void f (const char *s)
kono
parents:
diff changeset
7 {
kono
parents:
diff changeset
8 unsigned n = __builtin_strlen (s) + 1;
kono
parents:
diff changeset
9 char *p = __builtin_malloc (n);
kono
parents:
diff changeset
10 __builtin_memcpy (p, s, n);
kono
parents:
diff changeset
11 __builtin_free (p);
kono
parents:
diff changeset
12 }
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 void g (const char *s)
kono
parents:
diff changeset
15 {
kono
parents:
diff changeset
16 unsigned n = __builtin_strlen (s) + 1;
kono
parents:
diff changeset
17 char *p = __builtin_malloc (n);
kono
parents:
diff changeset
18 __builtin_strcpy (p, s);
kono
parents:
diff changeset
19 __builtin_free (p);
kono
parents:
diff changeset
20 }
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 /* { dg-final { scan-tree-dump-not "free" "optimized" } }
kono
parents:
diff changeset
23 { dg-final { scan-tree-dump-not "malloc" "optimized" } }
kono
parents:
diff changeset
24 { dg-final { scan-tree-dump-not "memcpy" "optimized" } }
kono
parents:
diff changeset
25 { dg-final { scan-tree-dump-not "strcpy" "optimized" } }
kono
parents:
diff changeset
26 { dg-final { scan-tree-dump-not "strlen" "optimized" } } */