blob: 56251fc340f9df28c0fad94e6e177d77d5dfdc81 [file] [log] [blame]
/* { 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" } } */