-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overflow behaviour relies on Optimization #5449
Labels
bug
Something isn't working
compiler: ir
IRgen and sway-ir including optimization passes
team:compiler
Compiler Team
Comments
Easy repro without dependence on #5385
On |
vaivaswatha
added a commit
that referenced
this issue
Jan 20, 2024
## Description This PR implements `-o` flags so that we can disable optimizations. This will be useful as we are working towards debugger support and optimizations pollute source map generated. Provide option to the e2e test binary to specify build profile. For tests that have their ABI tested, or rely on their compiled hashes (for deployment), since that changes with build profile, the tests are marked as unsupported for debug profile. (better to test with and have expected results for release than the debug profile). Add testing release profile in CI since the default is now debug. Two tests in `should_fail` that are expected to fail due to overflows are disabled because there's a bug in our IR gen. This is tracked by #5449 --------- Co-authored-by: Vaivaswatha Nagaraj <vaivaswatha.nagaraj@fuel.sh> Co-authored-by: Vaivaswatha N <vaivaswatha@users.noreply.github.com> Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
sdankel
added a commit
that referenced
this issue
Jan 24, 2024
This PR implements `-o` flags so that we can disable optimizations. This will be useful as we are working towards debugger support and optimizations pollute source map generated. Provide option to the e2e test binary to specify build profile. For tests that have their ABI tested, or rely on their compiled hashes (for deployment), since that changes with build profile, the tests are marked as unsupported for debug profile. (better to test with and have expected results for release than the debug profile). Add testing release profile in CI since the default is now debug. Two tests in `should_fail` that are expected to fail due to overflows are disabled because there's a bug in our IR gen. This is tracked by #5449 --------- Co-authored-by: Vaivaswatha Nagaraj <vaivaswatha.nagaraj@fuel.sh> Co-authored-by: Vaivaswatha N <vaivaswatha@users.noreply.github.com> Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
vaivaswatha
added a commit
that referenced
this issue
Jan 24, 2024
Fixes #5449 Without this fix, because we use `u8` load and store instructions, the overflow check (which relies on `u64` arithmetic) gets nullified.
vaivaswatha
added a commit
that referenced
this issue
Jan 30, 2024
Fixes #5449 Without this fix, because we use `u8` load and store instructions, the overflow check (which relies on `u64` arithmetic) gets nullified.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
compiler: ir
IRgen and sway-ir including optimization passes
team:compiler
Compiler Team
While implementing #5385, I found that when optimizations are disabled, (in particular,
constcombine
and/ormem2reg
for this bug), the IR we're generating for addition doesn't check for overflows correctly.This is the IR for
should_fail/arith_overflow/u8_add_overflow
(note that there's nomem2reg
orconstcombine
):Because we're using byte stores and loads for
u8
, we end up ignoring the overflowed part in the u64 register, thus not triggering the revert.When this issue is fixed, we should be enabling the tests
should_pass/arith_overflow/u8_add_overflow
andshould_pass/arith_overflow/u8_mul_overflow
which were both disabled in #5385.I suspect the bug got introduced with #4929.
The text was updated successfully, but these errors were encountered: