1 /*
2    20051110-2.c from the execute part of the gcc torture suite.
3  */
4 
5 #include <testfwk.h>
6 
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
10 
11 void add_unwind_adjustsp (long);
12 
13 unsigned char bytes[5];
14 
15 int flag;
16 
17 void
add_unwind_adjustsp(long offset)18 add_unwind_adjustsp (long offset)
19 {
20   int n;
21   unsigned long o;
22 
23   o = (long) ((offset - 0x204) >> 2);
24 
25   n = 0;
26   do
27     {
28 a:
29       bytes[n] = o & 0x7f;
30       o >>= 7;
31       if (o)
32         {
33 	  bytes[n] |= 0x80;
34 	  if (flag)
35 	    goto a;
36 	}
37       n++;
38     }
39   while (o);
40 }
41 
testTortureExecute(void)42 void testTortureExecute(void)
43 {
44   add_unwind_adjustsp (4132);
45   if (bytes[0] != 0x88 || bytes[1] != 0x07)
46     ASSERT (0);
47   return;
48 }
49