Mercurial > hg > CbC > CbC_gcc
view 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 |
line wrap: on
line source
/* PR tree-optimization/79715 - hand-rolled strdup with unused result not eliminated { dg-do compile } { dg-options "-O2 -Wall -fdump-tree-optimized" } */ void f (const char *s) { unsigned n = __builtin_strlen (s) + 1; char *p = __builtin_malloc (n); __builtin_memcpy (p, s, n); __builtin_free (p); } void g (const char *s) { unsigned n = __builtin_strlen (s) + 1; char *p = __builtin_malloc (n); __builtin_strcpy (p, s); __builtin_free (p); } /* { dg-final { scan-tree-dump-not "free" "optimized" } } { dg-final { scan-tree-dump-not "malloc" "optimized" } } { dg-final { scan-tree-dump-not "memcpy" "optimized" } } { dg-final { scan-tree-dump-not "strcpy" "optimized" } } { dg-final { scan-tree-dump-not "strlen" "optimized" } } */