summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/uninit-18.c
blob: 223983e107e088605671f7ebabe91066a6a7dc39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do compile }  */
/* { dg-options "-O -Wuninitialized" } */

char *foo(int bar, char *baz)
{
  char *tmp;

  if (bar & 3)
    tmp = baz;

  switch (bar) {
  case 1:
    tmp[5] = 7;    /* { dg-bogus "may be used uninitialized" } */
    break;
  case 2:
    tmp[11] = 15;  /* { dg-bogus "may be used uninitialized" } */
    break;
  default:
    tmp = 0;
    break;
  }

  return tmp;      /* { dg-bogus "may be used uninitialized" } */
}