gcc/
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-4.c
blobd39ecac77c4f688aab8f8e58444256e7da846e71
1 /* Spurious uninit variable warnings, case 4.
2 Simplified version of cppexp.c (cpp_parse_expr).
4 This one is really fragile, it gets it right if you take out case
5 1, or if the structure is replaced by an int, or if the structure
6 has fewer members (!) */
8 /* { dg-do compile } */
9 /* { dg-options "-O -Wuninitialized" } */
11 extern void abort (void);
13 struct operation {
14 short op;
15 char rprio;
16 char flags;
17 char unsignedp;
18 long value;
21 extern struct operation cpp_lex (void);
23 void
24 cpp_parse_expr (void)
26 int rprio; /* { dg-bogus "rprio" "uninitialized variable warning PR19833" } */
27 struct operation op;
29 for (;;)
31 op = cpp_lex ();
33 switch (op.op)
35 case 0:
36 break;
37 case 1:
38 return;
39 case 2:
40 rprio = 1;
41 break;
42 default:
43 return;
46 if (op.op == 0)
47 return;
49 if (rprio != 1)
50 abort();