Commit 6eac831
bug fix(semantic): Validate quotient in const DivRem to avoid signed MIN/-1 ICE.
The const-eval path for `DivRem::div_rem` stored the quotient without
validating it against the input type's range. For signed `iN::MIN / -1` the
quotient is `2^(N-1)` (= `iN::MAX + 1`), which is unrepresentable in `iN`;
the out-of-range value was silently stored and later caused an ICE in
sierra type-specialization (`Got failure while specializing type Const<i8, 128>`).
Now the quotient is validated via `validate_literal`, emitting a clean
E2008 LiteralError::OutOfRange — matching the `/` operator path.
Fixes #10132.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 8914649 commit 6eac831
4 files changed
Lines changed: 25 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
214 | 217 | | |
215 | 218 | | |
216 | 219 | | |
| |||
300 | 303 | | |
301 | 304 | | |
302 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
303 | 311 | | |
304 | | - | |
| 312 | + | |
305 | 313 | | |
306 | 314 | | |
307 | 315 | | |
308 | 316 | | |
309 | | - | |
| 317 | + | |
310 | 318 | | |
311 | 319 | | |
312 | 320 | | |
313 | | - | |
| 321 | + | |
314 | 322 | | |
315 | 323 | | |
316 | 324 | | |
317 | 325 | | |
318 | | - | |
| 326 | + | |
319 | 327 | | |
320 | 328 | | |
321 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
931 | 932 | | |
932 | 933 | | |
933 | 934 | | |
934 | | - | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
935 | 944 | | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | | - | |
| 945 | + | |
940 | 946 | | |
941 | 947 | | |
942 | 948 | | |
| |||
0 commit comments