Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/torture/pr93947.c

raw
1 /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */
2
3 #include "../analyzer-decls.h"
4
5 struct pf {
6 unsigned int iu : 2;
7 };
8
9 enum {
10 qr, jv, vm, mz,
11 };
12
13 int uh;
14
15 void
16 w9 (struct pf *x2)
17 {
18 /* We ought to know the following based on the bitfield width. */
19 __analyzer_eval (x2->iu >= 0 ); /* { dg-warning "TRUE" } */
20 __analyzer_eval (x2->iu < 4 ); /* { dg-warning "TRUE" } */
21
22 switch (x2->iu)
23 {
24 case qr:
25 case jv:
26 case vm:
27 uh = 0;
28 break;
29
30 case mz:
31 break;
32
33 default:
34 /* We ought to know from the enum values that this code is unreachable,
35 and thus not print anything.
36 TODO(xfail): currently this doesn't work. */
37 __analyzer_eval (x2->iu); /* { dg-bogus "" "" { xfail *-*-* } } */
38 __builtin_abort ();
39 }
40 }