comparison gcc/testsuite/gcc.dg/vrp-overflow-1.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fno-tree-forwprop" } */
3
4 extern void __attribute__((noreturn)) unreachable (void);
5
6 int fle22 (int a)
7 {
8 unsigned i = a / 4;
9 unsigned j = i - 2;
10
11 if (j == 7) /* A dynamic range excludes a value from j for the rest of f1. */
12 return -1;
13
14 if (i <= 2) /* This dynamic range cannot be combined or compared with that of j. */
15 return 0;
16
17 if (i <= j) /* And so we couldn't compute this result. */
18 unreachable ();
19
20 return 1;
21 }
22
23 int fle32 (int a)
24 {
25 unsigned i = a / 4;
26 unsigned j = i - 3;
27
28 if (j == 7) /* A dynamic range excludes a value from j for the rest of f1. */
29 return -1;
30
31 if (i <= 2) /* This dynamic range cannot be combined or compared with that of j. */
32 return 0;
33
34 if (i <= j) /* And so we couldn't compute this result. */
35 unreachable ();
36
37 return 1;
38 }
39
40 int flt22 (int a)
41 {
42 unsigned i = a / 4;
43 unsigned j = i - 2;
44
45 if (j == 7)
46 return -1;
47
48 if (i <= 2)
49 return 0;
50
51 if (i < j)
52 unreachable ();
53
54 return 1;
55 }
56
57 int flt32 (int a)
58 {
59 unsigned i = a / 4;
60 unsigned j = i - 3;
61
62 if (j == 7)
63 return -1;
64
65 if (i <= 2)
66 return 0;
67
68 if (i < j)
69 unreachable ();
70
71 return 1;
72 }
73
74 int fgt22 (int a)
75 {
76 unsigned i = a / 4;
77 unsigned j = i + 2;
78
79 if (j == -7)
80 return -1;
81
82 if (i >= -3)
83 return 0;
84
85 if (i > j)
86 unreachable ();
87
88 return 1;
89 }
90
91 int fgt32 (int a)
92 {
93 unsigned i = a / 4;
94 unsigned j = i + 3;
95
96 if (j == -7)
97 return -1;
98
99 if (i >= -3)
100 return 0;
101
102 if (i > j)
103 unreachable ();
104
105 return 1;
106 }
107
108 int fge22 (int a)
109 {
110 unsigned i = a / 4;
111 unsigned j = i + 2;
112
113 if (j == -7)
114 return -1;
115
116 if (i >= -3)
117 return 0;
118
119 if (i >= j)
120 unreachable ();
121
122 return 1;
123 }
124
125 int fge32 (int a)
126 {
127 unsigned i = a / 4;
128 unsigned j = i + 3;
129
130 if (j == -7)
131 return -1;
132
133 if (i >= -3)
134 return 0;
135
136 if (i >= j)
137 unreachable ();
138
139 return 1;
140 }
141
142 int main (int argc, char *argv[]) {
143 fle22 (argc);
144 fle32 (argc);
145 flt22 (argc);
146 flt32 (argc);
147 fgt22 (argc);
148 fgt32 (argc);
149 fge22 (argc);
150 fge32 (argc);
151 }