PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / pr79715.c
blob0f0f90f712243247645faa2bcf4af0f8835a574f
1 /* PR tree-optimization/79715 - hand-rolled strdup with unused result
2 not eliminated
3 { dg-do compile }
4 { dg-options "-O2 -Wall -fdump-tree-optimized" } */
6 void f (const char *s)
8 unsigned n = __builtin_strlen (s) + 1;
9 char *p = __builtin_malloc (n);
10 __builtin_memcpy (p, s, n);
11 __builtin_free (p);
14 void g (const char *s)
16 unsigned n = __builtin_strlen (s) + 1;
17 char *p = __builtin_malloc (n);
18 __builtin_strcpy (p, s);
19 __builtin_free (p);
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" } } */