view gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-37.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* { dg-options "-O2 -fdump-tree-dse-details -fno-tree-fre" } */


#ifndef SCOPE
#define SCOPE
#endif

extern void frob (char *);

void g (char *s)
{
  SCOPE char a[8];
  __builtin_strncpy (a, s, sizeof a);
  __builtin_memset (a, 0, sizeof a); 
  frob (a);
}

void h (char *s)
{
  SCOPE char a[8];
  __builtin_memset (a, 0, sizeof a); 
  __builtin_strncpy (a, s, sizeof a);
  frob (a);
}

void i (char *s)
{
  SCOPE char a[8];
  __builtin_strncpy (a, s, sizeof a);
  __builtin_memset (a, 0, sizeof a - 5); 
  frob (a);
}

void j (char *s)
{
  SCOPE char a[8];
  __builtin_memset (a, 0, sizeof a); 
  __builtin_strncpy (a, s, sizeof a - 5);
  frob (a);
}

void l (char *s)
{
  SCOPE char a[8];
  __builtin_strncpy (a, s, sizeof a);
  __builtin_memset (a + 2, 0, sizeof a - 2); 
  frob (a);
}

void m (char *s)
{
  SCOPE char a[8];
  __builtin_memset (a, 0, sizeof a); 
  __builtin_strncpy (a + 2, s, sizeof a - 2);
  frob (a);
}

/* { dg-final { scan-tree-dump-times "Deleted dead call" 2 "dse1" } } */
/* { dg-final { scan-tree-dump-times "Trimming statement " 4 "dse1" } } */