Debian Codegraph @

gcc/testsuite/gcc.dg/auto-init-pr102276-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wall -ftrivial-auto-var-init=zero" } */
3
4 int g(int *);
5 int f()
6 {
7 switch (0) {
8 int x; /* { dg-bogus "statement will never be executed" } */
9 default:
10 return g(&x);
11 }
12 }
13
14 int g1(int);
15 int f1()
16 {
17 switch (0) {
18 int x; /* { dg-bogus "statement will never be executed" } */
19 default:
20 return g1(x); /* { dg-warning "is used uninitialized" } */
21 }
22 }
23
24 struct S
25 {
26 char a;
27 int b;
28 };
29 int g2(int);
30 int f2(int input)
31 {
32 switch (0) {
33 struct S x; /* { dg-bogus "statement will never be executed" } */
34 default:
35 return g2(input) + x.b; /* { dg-warning "is used uninitialized" } */
36 }
37 }
38