aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr66648.c
blob: 88c126fff8c006905e2fb43c01c551be73db3b86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* { dg-do run } */
/* { dg-options "-O2 -mstringop-strategy=unrolled_loop -mtune=nocona" } */

#define PATTERN 0xdeadbeef
#define SIZE    32

struct S { int i; char str[SIZE]; int j; };

void __attribute__((noclone, noinline))
my_memcpy (char *, const char *, unsigned int);

void
my_memcpy (char *dst, const char *src, unsigned int len)
{
  if (len < 8)
    __builtin_abort ();

  __builtin_memcpy (dst, src, len);
}

int
main (void)
{
  const char str[SIZE]= "1234567890123456789012345678901";
  struct S *s = __builtin_malloc (sizeof (struct S));

  s->j = PATTERN;
  my_memcpy (s->str, str, SIZE);
  if (s->j != PATTERN)
    __builtin_abort ();

  return 0;
}