Skip to content

Compiler panics with "attempt to multiply with overflow" #7161

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

Open
ironcev opened this issue May 6, 2025 · 0 comments
Open

Compiler panics with "attempt to multiply with overflow" #7161

ironcev opened this issue May 6, 2025 · 0 comments
Labels
bug Something isn't working compiler: codegen Everything to do with IR->ASM, register allocation, etc. compiler: ir IRgen and sway-ir including optimization passes compiler General compiler. Should eventually become more specific as the issue is triaged team:compiler Compiler Team

Comments

@ironcev
Copy link
Member

ironcev commented May 6, 2025

When running the in_language_tests using forc test --release but with the forc built in debug mode, the following tests cause compiler panic with the error given below:

  • math_inline_tests::revert_math_u64_overflow_mul
  • math_inline_tests::revert_math_u64_mul_unsafe_math
  • math_inline_tests::math_u64_overflow_mul
thread 'main' panicked at sway-core/src/asm_generation/fuel/optimizations/const_indexed_aggregates.rs:118:85:
attempt to multiply with overflow

Compiler does not panic in these tests when compiled in release mode.

@ironcev ironcev added bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged compiler: ir IRgen and sway-ir including optimization passes compiler: codegen Everything to do with IR->ASM, register allocation, etc. team:compiler Compiler Team labels May 7, 2025
ironcev added a commit that referenced this issue May 13, 2025
## Description

This PR:
- changes the configuration of Forc and Forc plugins used in CI steps
from `debug` to `release`.
- changes the `forc-unit-tests` CI step, to run the tests both in
`debug` and `release` mode.

By switching to `release` builds, we ensure that we test the versions
that are actually released, unlike the `debug` version. As a
consequence, execution time of CI steps gets shortened. The drawback is
potentially not catching issues detectable only in the `debug` mode,
like, e.g., overflows. We will add a separate CI workflow, running
nightly or on tagged versions only, that will use `debug` builds as
explained in #7168.

Currently, we are running `forc-unit-tests` only in the `debug` mode.
Compiler panics in `in_language_tests`, described in #7157, that happens
only in `release` mode, shows that it is beneficial to run the unit test
both in `debug` and `release` mode. Similar is with compiler panics
described in #7161.

The PR also removes the explicit `forc build` part from those tests and
leaves only the `forc test` part. The reasoning behind that change is,
that `forc test` also builds the projects, indeed with tests included,
but, since we currently don't support `#[cfg(test)]`, otherwise
unchanged. Running `forc build` in addition effectively doubles the test
execution time, and the actual benefit in testing, compared to running
only `forc test` is, in best case, negligible.

## Checklist

- [x] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Sophie Dankel <[email protected]>
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: codegen Everything to do with IR->ASM, register allocation, etc. compiler: ir IRgen and sway-ir including optimization passes compiler General compiler. Should eventually become more specific as the issue is triaged team:compiler Compiler Team
Projects
None yet
Development

No branches or pull requests

1 participant