comparison gcc/testsuite/gcc.dg/uninit-4-O0.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Spurious uninit variable warnings, case 4.
2 Simplified version of cppexp.c (cpp_parse_expr).
3
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 (!) */
7
8 /* { dg-do compile } */
9 /* { dg-options "-Wuninitialized" } */
10
11 extern void abort (void);
12
13 struct operation {
14 short op;
15 char rprio;
16 char flags;
17 char unsignedp;
18 long value;
19 };
20
21 extern struct operation cpp_lex (void);
22
23 void
24 cpp_parse_expr (void)
25 {
26 int rprio; /* { dg-bogus "rprio" "uninitialized variable warning PR19833" } */
27 struct operation op;
28
29 for (;;)
30 {
31 op = cpp_lex ();
32
33 switch (op.op)
34 {
35 case 0:
36 break;
37 case 1:
38 return;
39 case 2:
40 rprio = 1;
41 break;
42 default:
43 return;
44 }
45
46 if (op.op == 0)
47 return;
48
49 if (rprio != 1)
50 abort();
51 }
52 }