summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-960326-1.c
blob: 5b9ed65ff550edef8cbd02739c24f693d09d2d13 (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
/*
   960326-1.c from the execute part of the gcc torture suite.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

struct s
{
  char a;
  int b;
  short c;
  int d[3];
  long e;
};

struct s s0 = { .b = 3, .d = {2} };
struct s static s1 = { .b = 3, .d = {2} };

void
testTortureExecute (void)
{
#ifndef __SDCC_pdk14 // Lack of memory
  struct s s2 = { .b = 3, .d = {2} };
  static struct s s3 = { .b = 3, .d = {2} };

  ASSERT (s0.a == 0 && s0.b == 3 && s0.c == 0 && s0.d[0] == 2 && s0.d[1] == 0 && s0.d[2] == 0 && s0.e == 0);
  ASSERT (s1.a == 0 && s1.b == 3 && s1.c == 0 && s1.d[0] == 2 && s1.d[1] == 0 && s1.d[2] == 0 && s1.e == 0);
  ASSERT (s2.a == 0 && s2.b == 3 && s2.c == 0 && s2.d[0] == 2 && s2.d[1] == 0 && s2.d[2] == 0 && s2.e == 0);
  ASSERT (s3.a == 0 && s3.b == 3 && s3.c == 0 && s3.d[0] == 2 && s3.d[1] == 0 && s3.d[2] == 0 && s3.e == 0);
 
  return;
#endif
}