summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20011024-1.c
blob: 05f96f0071fe8bee66e27fd95594564f71abd9c0 (plain) (blame)
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
34
35
/*
   20011024-1.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

/* Test whether store motion recognizes pure functions as potentially reading
   any memory.  */

#include <string.h>

#if defined(__SDCC_pdk14)
char buf[10];
#else
char buf[50];
#endif

static void foo (void)
{
  if (memcpy (buf, "abc", 4) != buf) ASSERT (0);
  if (strcmp (buf, "abc")) ASSERT (0);
  memcpy (buf, "abcdefgh", strlen ("abcdefgh") + 1);
}

void
testTortureExecute (void)
{
  foo ();
  return;
}