summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr35258.c
blob: d1c45a79dc7405488559fc15cb9394753ec70aba (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
/* { dg-do run } */
/* { dg-options "-O1" } */

extern void *memcpy (void *, const void *, __SIZE_TYPE__);
extern int memcmp (const void *, const void *, __SIZE_TYPE__);
extern void abort(void);

char str[9] = "1234";

void
bar (void)
{
  unsigned int temp;
  char *p = &str[2];

  memcpy (&temp, &str[1], 4);
  memcpy (p, &temp, 4);
  str[1] = '.';
}

int main()
{
  bar();
  if (memcmp (str, "1.234", 5) != 0)
    abort ();

  return 0;
}