summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20020619-1.c
blob: 4b607f6845424a04511a5f84528c709232ec9069 (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
36
37
38
39
40
/*
   20020619-1.c from the execute part of the gcc torture suite.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

#include <stdint.h>
#include <string.h>

typedef int32_t int32;

static int32 ref(void)
{
  union {
    char c[5];
    int32 i;
  } u;

  memset (&u, 0, sizeof(u));
  u.c[0] = 1;
  u.c[1] = 2;
  u.c[2] = 3;
  u.c[3] = 4;

  return u.i;
}

void
testTortureExecute (void)
{
  int32 b = ref();
  if (b != 0x01020304
      && b != 0x04030201)
    ASSERT (0);
  return;
}