Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr39240.c
blob9e98ec5bd64eccc82aaa15441ca4ad3d4b477507
1 /*
2 pr39240.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* PR target/39240 */
13 static int foo1 (int x)
15 return x;
18 unsigned int bar1 (int x)
20 return foo1 (x + 6);
23 volatile unsigned long l1 = (unsigned int) -4;
25 static short int foo2 (int x)
27 return x;
30 unsigned short int bar2 (int x)
32 return foo2 (x + 6);
35 volatile unsigned long l2 = (unsigned short int) -4;
37 #if !defined(__SDCC_pdk14) // Lack of memory
38 static signed char foo3 (int x)
40 return x;
43 unsigned char bar3 (int x)
45 return foo3 (x + 6);
48 volatile unsigned long l3 = (unsigned char) -4;
50 static unsigned int foo4 (int x)
52 return x;
55 int bar4 (int x)
57 return foo4 (x + 6);
60 volatile unsigned long l4 = (int) -4;
62 static unsigned short int foo5 (int x)
64 return x;
67 short int bar5 (int x)
69 return foo5 (x + 6);
72 volatile unsigned long l5 = (short int) -4;
74 static unsigned char foo6 (int x)
76 return x;
79 signed char bar6 (int x)
81 return foo6 (x + 6);
84 volatile unsigned long l6 = (signed char) -4;
85 #endif
87 void
88 testTortureExecute (void)
90 if (bar1 (-10) != l1)
91 ASSERT (0);
92 if (bar2 (-10) != l2)
93 ASSERT (0);
94 #if !defined(__SDCC_pdk14) // Lack of memory
95 if (bar3 (-10) != l3)
96 ASSERT (0);
97 if (bar4 (-10) != l4)
98 ASSERT (0);
99 if (bar5 (-10) != l5)
100 ASSERT (0);
101 if (bar6 (-10) != l6)
102 ASSERT (0);
103 #endif
104 return;