OSDN Git Service

fixincludes:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / compile / 981006-1.c
1 /* Test that tablejump insns are correctly handled.  If the compiler
2    loses track of the jump targets, it will report that x and y can be
3    used uninitialized.
4
5    This is broken in egcs 1998/10/06 for mips in pic mode.  */
6 /* { dg-do assemble } */
7 /* For MIPS at least, pic is needed to trigger the problem. */
8 /* { dg-options "-w -Wuninitialized -Werror -fpic" } */
9 /* { dg-options "-w -Wuninitialized -Werror" { target { { rs6000-*-aix* powerpc*-*-aix* arm*-*-* fr30-*-* sh-*-hms h8300*-*-* cris-*-elf* mmix-*-* } || { ! fpic } } } } */
10
11 int foo (int a, int b)
12 {
13   __label__ z;
14   int x; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */
15   int y; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */
16   static void *p;
17
18   switch (a) {
19   case 2:
20     x = 4;
21     break;
22   case 4:
23     x = 6;
24     break;
25   case 8: case 10: case 13: case 11: case 17: case 19:
26     x = 7;
27     break;
28   default:
29     x = -1;
30     break;
31   }
32   switch (b) {
33   case 2:
34     y = 4;
35     break;
36   case 4:
37     y = 6;
38     break;
39   case 8: case 10: case 13: case 11: case 17: case 19:
40     y = 7;
41     break;
42   default:
43     y = -1;
44     break;
45   }
46  z:
47   p = &&z;
48   return x * y;
49 }
50 int main (int argc, char *argv[])
51 {
52   return 1 == foo (argc, argc + 1);
53 }