modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/compile/981006-1.c (about)

     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  /* { dg-require-effective-target label_values } */
    11  
    12  int foo (int a, int b)
    13  {
    14    __label__ z;
    15    int x; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */
    16    int y; /* { dg-bogus "warning: `.' might be used uninitialized in this function" } */
    17    static void *p;
    18  
    19    switch (a) {
    20    case 2:
    21      x = 4;
    22      break;
    23    case 4:
    24      x = 6;
    25      break;
    26    case 8: case 10: case 13: case 11: case 17: case 19:
    27      x = 7;
    28      break;
    29    default:
    30      x = -1;
    31      break;
    32    }
    33    switch (b) {
    34    case 2:
    35      y = 4;
    36      break;
    37    case 4:
    38      y = 6;
    39      break;
    40    case 8: case 10: case 13: case 11: case 17: case 19:
    41      y = 7;
    42      break;
    43    default:
    44      y = -1;
    45      break;
    46    }
    47   z:
    48    p = &&z;
    49    return x * y;
    50  }
    51  int main (int argc, char *argv[])
    52  {
    53    return 1 == foo (argc, argc + 1);
    54  }