summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-pr39240.c
blob: 9e98ec5bd64eccc82aaa15441ca4ad3d4b477507 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
   pr39240.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

/* PR target/39240 */

static int foo1 (int x)
{
  return x;
}

unsigned int bar1 (int x)
{
  return foo1 (x + 6);
}

volatile unsigned long l1 = (unsigned int) -4;

static short int foo2 (int x)
{
  return x;
}

unsigned short int bar2 (int x)
{
  return foo2 (x + 6);
}

volatile unsigned long l2 = (unsigned short int) -4;

#if !defined(__SDCC_pdk14) // Lack of memory
static signed char foo3 (int x)
{
  return x;
}

unsigned char bar3 (int x)
{
  return foo3 (x + 6);
}

volatile unsigned long l3 = (unsigned char) -4;

static unsigned int foo4 (int x)
{
  return x;
}

int bar4 (int x)
{
  return foo4 (x + 6);
}

volatile unsigned long l4 = (int) -4;

static unsigned short int foo5 (int x)
{
  return x;
}

short int bar5 (int x)
{
  return foo5 (x + 6);
}

volatile unsigned long l5 = (short int) -4;

static unsigned char foo6 (int x)
{
  return x;
}

signed char bar6 (int x)
{
  return foo6 (x + 6);
}

volatile unsigned long l6 = (signed char) -4;
#endif

void
testTortureExecute (void)
{
  if (bar1 (-10) != l1)
    ASSERT (0);
  if (bar2 (-10) != l2)
    ASSERT (0);
#if !defined(__SDCC_pdk14) // Lack of memory
  if (bar3 (-10) != l3)
    ASSERT (0);
  if (bar4 (-10) != l4)
    ASSERT (0);
  if (bar5 (-10) != l5)
    ASSERT (0);
  if (bar6 (-10) != l6)
    ASSERT (0);
#endif
  return;
}