summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-930526-1.c
blob: a561f66d9ceef9c4e238a66f4626779efb2b3da9 (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
41
42
43
44
45
/*
   930526-1.c from the execute part of the gcc torture suite.
 */

#include <testfwk.h>
#include <string.h>

#ifdef __SDCC
#pragma std_c99
#endif

#ifndef __SDCC_pdk14 // Lack of memory
inline
void f (int x)
{
  int *(p[3]);
  int m[3*4];
  int i;

  memset (m, 0x00, sizeof (m));

  for (i = 0; i < 3; i++)
    p[i] = m + x*i;

  p[0][2] = 0x5555;
  p[1][0] = 0x3333;
  p[2][1] = -23456;

  ASSERT (m[2] == 0x5555);
  ASSERT (m[4] == 0x3333);
  ASSERT (m[9] == -23456);
}
#endif

void
testTortureExecute (void)
{
#ifndef __SDCC_pdk14 // Lack of memory
  f (4);
  return;
#endif
}

extern inline void f (int x);