1 /* PR tree-optimization/79715 - hand-rolled strdup with unused result
4 { dg-options "-O2 -Wall -fdump-tree-optimized" } */
8 unsigned n
= __builtin_strlen (s
) + 1;
9 char *p
= __builtin_malloc (n
);
10 __builtin_memcpy (p
, s
, n
);
14 void g (const char *s
)
16 unsigned n
= __builtin_strlen (s
) + 1;
17 char *p
= __builtin_malloc (n
);
18 __builtin_strcpy (p
, s
);
22 /* { dg-final { scan-tree-dump-not "free" "optimized" } }
23 { dg-final { scan-tree-dump-not "malloc" "optimized" } }
24 { dg-final { scan-tree-dump-not "memcpy" "optimized" } }
25 { dg-final { scan-tree-dump-not "strcpy" "optimized" } }
26 { dg-final { scan-tree-dump-not "strlen" "optimized" } } */