diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2023-06-03 18:22:43 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:51:10 -0700 |
| commit | 7702af5eb2d986d46b6978dafcf4b174313167e4 (patch) | |
| tree | e18aec9e4935644c6dbb200820c803c286076ba5 /src/codegen/llvm.zig | |
| parent | 2a6b91874ae970c0fba63f8c1357da5a57feec27 (diff) | |
| download | zig-7702af5eb2d986d46b6978dafcf4b174313167e4.tar.gz zig-7702af5eb2d986d46b6978dafcf4b174313167e4.zip | |
Sema: fix int arithmetic overflow checks
Previously, these checks worked by performing the arithmetic operation,
then checking whether the result fit in the type in question. Since all
values are now typed, this approach was no longer valid, and was
tripping some assertions due to trying to store too-large values in
smaller types.
Now, `intAdd`, `intSub`, `intMul` and `intDiv` all check for overflow,
and if it happens, re-do the operation with the result being a
`comptime_int`, and reporting the error (and vector index) to the caller
so that the error can be reported.
After this change, all test cases are passing.
Diffstat (limited to 'src/codegen/llvm.zig')
0 files changed, 0 insertions, 0 deletions
