aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/auto-init-pr102276-1.c
blob: d574926e0c83f7d8e1a92a92f3b505ad2714de5c (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* { dg-do compile } */
/* { dg-options "-O2 -Wall -ftrivial-auto-var-init=zero" } */

int g(int *);
int f()
{
    switch (0) { 
        int x;  /* { dg-bogus "statement will never be executed" } */
        default:
        return g(&x);
    }
}

int g1(int);
int f1()
{
    switch (0) {
        int x; /* { dg-bogus "statement will never be executed" } */
        default:
        return g1(x);  /* { dg-warning "is used uninitialized" } */
    }
}

struct S
{
  char a;
  int b;
};
int g2(int);
int f2(int input)
{
    switch (0) {
        struct S x; /* { dg-bogus "statement will never be executed" } */
        default:
        return g2(input) + x.b;  /* { dg-warning "is used uninitialized" } */
    }
}