Merge with trank @ 137446
[official-gcc.git] / gcc / testsuite / gcc.c-torture / compile / 981006-1.c
bloba8b4cc48cd6af0db17eb970a5dad3c486af56ef4
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.
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 sh-*-coff h8300*-*-* cris-*-elf* mmix-*-* } || { ! fpic } } } } */
11 int foo (int a, int b)
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;
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;
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;
47 p = &&z;
48 return x * y;
50 int main (int argc, char *argv[])
52 return 1 == foo (argc, argc + 1);