1 /* 2 pr39240.c from the execute part of the gcc torture tests. 3 */ 4 5 #include <testfwk.h> 6 7 #ifdef __SDCC 8 #pragma std_c99 9 #endif 10 11 /* PR target/39240 */ 12 foo1(int x)13static int foo1 (int x) 14 { 15 return x; 16 } 17 bar1(int x)18unsigned int bar1 (int x) 19 { 20 return foo1 (x + 6); 21 } 22 23 volatile unsigned long l1 = (unsigned int) -4; 24 foo2(int x)25static short int foo2 (int x) 26 { 27 return x; 28 } 29 bar2(int x)30unsigned short int bar2 (int x) 31 { 32 return foo2 (x + 6); 33 } 34 35 volatile unsigned long l2 = (unsigned short int) -4; 36 37 #if !defined(__SDCC_pdk14) // Lack of memory foo3(int x)38static signed char foo3 (int x) 39 { 40 return x; 41 } 42 bar3(int x)43unsigned char bar3 (int x) 44 { 45 return foo3 (x + 6); 46 } 47 48 volatile unsigned long l3 = (unsigned char) -4; 49 foo4(int x)50static unsigned int foo4 (int x) 51 { 52 return x; 53 } 54 bar4(int x)55int bar4 (int x) 56 { 57 return foo4 (x + 6); 58 } 59 60 volatile unsigned long l4 = (int) -4; 61 foo5(int x)62static unsigned short int foo5 (int x) 63 { 64 return x; 65 } 66 bar5(int x)67short int bar5 (int x) 68 { 69 return foo5 (x + 6); 70 } 71 72 volatile unsigned long l5 = (short int) -4; 73 foo6(int x)74static unsigned char foo6 (int x) 75 { 76 return x; 77 } 78 bar6(int x)79signed char bar6 (int x) 80 { 81 return foo6 (x + 6); 82 } 83 84 volatile unsigned long l6 = (signed char) -4; 85 #endif 86 87 void testTortureExecute(void)88testTortureExecute (void) 89 { 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; 105 } 106 107