Home | History | Annotate | Download | only in ld-sh
      1 int global;
      2 
      3 extern void trap (int, int);
      4 static void quit (int);
      5 static int foo (int);
      6 
      7 int
      8 main ()
      9 {
     10   if (foo (0) != 0 || global != 0)
     11     quit (1);
     12   if (foo (1) != 1 || global != 1)
     13     quit (1);
     14   if (foo (2) != 2 || global != 2)
     15     quit (1);
     16   if (foo (3) != 3 || global != 3)
     17     quit (1);
     18   if (foo (4) != 4 || global != 4)
     19     quit (1);
     20   if (foo (5) != 5 || global != 5)
     21     quit (1);
     22   if (foo (6) != 6 || global != 6)
     23     quit (1);
     24   if (foo (7) != 7 || global != 7)
     25     quit (1);
     26   if (foo (8) != 8 || global != 8)
     27     quit (1);
     28   quit (0);
     29 }
     30 
     31 void
     32 __main ()
     33 {
     34 }
     35 
     36 static void
     37 quit (int status)
     38 {
     39   trap (1, status);
     40 }
     41 
     42 int
     43 bar (int i)
     44 {
     45   global = i;
     46   return i;
     47 }
     48 
     49 int
     50 bar0 (int i)
     51 {
     52   global = 0;
     53   return i;
     54 }
     55 
     56 int
     57 bar1 (int i)
     58 {
     59   global = 1;
     60   return i;
     61 }
     62 
     63 int
     64 bar2 (int i)
     65 {
     66   global = 2;
     67   return i;
     68 }
     69 
     70 int
     71 bar3 (int i)
     72 {
     73   global = 3;
     74   return i;
     75 }
     76 
     77 int
     78 bar4 (int i)
     79 {
     80   global = 4;
     81   return i;
     82 }
     83 
     84 int
     85 bar5 (int i)
     86 {
     87   global = 5;
     88   return i;
     89 }
     90 
     91 int
     92 bar6 (int i)
     93 {
     94   global = 6;
     95   return i;
     96 }
     97 
     98 int
     99 bar7 (int i)
    100 {
    101   global = 7;
    102   return i;
    103 }
    104 
    105 int
    106 foo (int i)
    107 {
    108   switch (i)
    109     {
    110     case 0: bar0 (0); return 0;
    111     case 1: bar1 (1); return 1;
    112     case 2: bar2 (2); return 2;
    113     case 3: bar3 (3); return 3;
    114     case 4: bar4 (4); return 4;
    115     case 5: bar5 (5); return 5;
    116     case 6: bar6 (6); return 6;
    117     case 7: bar7 (7); return 7;
    118     default: return bar (i);
    119     }
    120 }
    121