aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/auto-init-pr102276-2.c
blob: 779d3ec3882339ec4526fc40635eb854dde74f29 (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=pattern" } */

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" } */
    }
}