1 #include "analyzer-decls.h"
2
3 void external_fn(void);
4
5 struct st_1
6 {
7 char *name;
8 unsigned size;
9 };
10
11 void test_1a (void *p, unsigned next_off)
12 {
13 struct st_1 *r = p;
14
15 external_fn();
16
17 if (next_off >= r->size)
18 return;
19
20 if (next_off >= r->size)
21 /* We should have already returned if this is the case. */
22 __analyzer_dump_path (); /* { dg-bogus "path" } */
23 }
24
25 void test_1b (void *p, unsigned next_off)
26 {
27 struct st_1 *r = p;
28
29 if (next_off >= r->size)
30 return;
31
32 if (next_off >= r->size)
33 /* We should have already returned if this is the case. */
34 __analyzer_dump_path (); /* { dg-bogus "path" } */
35 }
36
37 void test_1c (struct st_1 *r, unsigned next_off)
38 {
39 if (next_off >= r->size)
40 return;
41
42 if (next_off >= r->size)
43 /* We should have already returned if this is the case. */
44 __analyzer_dump_path (); /* { dg-bogus "path" } */
45 }
46
47 void test_1d (struct st_1 *r, unsigned next_off)
48 {
49 external_fn();
50
51 if (next_off >= r->size)
52 return;
53
54 if (next_off >= r->size)
55 /* We should have already returned if this is the case. */
56 __analyzer_dump_path (); /* { dg-bogus "path" } */
57 }
58
59 void test_1e (void *p, unsigned next_off)
60 {
61 struct st_1 *r = p;
62
63 while (1)
64 {
65 external_fn();
66
67 if (next_off >= r->size)
68 return;
69
70 __analyzer_dump_path (); /* { dg-message "path" } */
71 }
72 }
73
74 struct st_2
75 {
76 char *name;
77 unsigned arr[10];
78 };
79
80 void test_2a (void *p, unsigned next_off)
81 {
82 struct st_2 *r = p;
83
84 external_fn();
85
86 if (next_off >= r->arr[5])
87 return;
88
89 if (next_off >= r->arr[5])
90 /* We should have already returned if this is the case. */
91 __analyzer_dump_path (); /* { dg-bogus "path" } */
92 }
93
94 void test_2b (void *p, unsigned next_off, int idx)
95 {
96 struct st_2 *r = p;
97
98 external_fn();
99
100 if (next_off >= r->arr[idx])
101 return;
102
103 if (next_off >= r->arr[idx])
104 /* We should have already returned if this is the case. */
105 __analyzer_dump_path (); /* { dg-bogus "path" } */
106 }