Skip to content
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

[Bug] nested mul_div panicked #8516

Closed
0xbe1 opened this issue Jun 4, 2023 · 5 comments
Closed

[Bug] nested mul_div panicked #8516

0xbe1 opened this issue Jun 4, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@0xbe1
Copy link
Contributor

0xbe1 commented Jun 4, 2023

🐛 Bug

To reproduce

Code snippet to reproduce

This test passes

#[test]
fun test_nested_mul_div() {
    let a = math64::mul_div(1, 1, 1);
    assert!(math64::mul_div(1, a,1) == 1, 0);
}

This test throws exception.

#[test]
fun test_nested_mul_div() {
    assert!(math64::mul_div(1, math64::mul_div(1, 1, 1),1) == 1, 0);
}

error:

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', third_party/move/move-compiler/src/to_bytecode/context.rs:204:73
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected Behavior

nested should be fine

System information

{
  "Result": {
    "build_branch": "main",
    "build_cargo_version": "cargo 1.66.1 (ad779e08b 2023-01-10)",
    "build_clean_checkout": "false",
    "build_commit_hash": "c9cb442e6f03aaa37687d30899480d40408d0719",
    "build_is_release_build": "true",
    "build_os": "macos-x86_64",
    "build_pkg_version": "2.0.0",
    "build_profile_name": "cli",
    "build_rust_channel": "1.66.1-x86_64-apple-darwin",
    "build_rust_version": "rustc 1.66.1 (90743e729 2023-01-10)",
    "build_tag": "",
    "build_time": "2023-06-01 19:50:01 +00:00",
    "build_using_tokio_unstable": "true"
  }
}
@0xbe1 0xbe1 added the bug Something isn't working label Jun 4, 2023
@movekevin
Copy link
Contributor

After some quick debugging, I think this is due to the way inline functions work - you can't have inline functions inside inline functions. cc @wrwg

@wrwg
Copy link
Contributor

wrwg commented Jun 4, 2023

After some quick debugging, I think this is due to the way inline functions work - you can't have inline functions inside inline functions. cc @wrwg

Definitely you can have inline functions inside inline functions, it happens frequently in the functionals in the framework. This must be something different.

@movekevin
Copy link
Contributor

Doing this currently fails with the following error:

bug[ICE12001]: BYTECODE GENERATION FAILED
  ┌─ /Users/kevin/aptos-core/aptos-move/framework/aptos-stdlib/sources/math64.move:2:19
  │
2 │ module aptos_std::math64 {
  │                   ^^^^^^ IR ERROR: Unbound function Self.mul_div

@0xbe1 0xbe1 changed the title [Bug] nested mul_div throws [Bug] nested mul_div panicked Jun 4, 2023
@mkurnikov
Copy link
Contributor

mkurnikov commented Jun 5, 2023

@wrwg @movekevin

Definitely you can have inline functions inside inline functions, it happens frequently in the functionals in the framework. This must be something different.

I think it currently requires nested inline function to be defined at the same module as the invocation place.

BYTECODE GENERATION FAILED

The same appears with inline functions that have constants, try to call math128::ceil_div() from anywhere other than math128 itself.

P.S. I suggest Aptos developers to implement tests for the public functions in modules different from the declaration module, i.e. math128_tests.move for math128. It helps catch those bugs early, and makes sure that users have all the necessary APIs to initialize things for example.

@lbmeiyi lbmeiyi moved this from 🆕 New to For Grabs in Move Language and Runtime Jun 14, 2023
@brmataptos brmataptos self-assigned this Jun 17, 2023
@wrwg wrwg moved this from For Grabs to 🏗 In progress in Move Language and Runtime Jun 22, 2023
brmataptos added a commit that referenced this issue Jun 27, 2023
… inlined method.

Includes test case illustrating original bug (#8516)
plus a few tests to double-check a few cases of multiple inlining and recursive inlining.  A few
tests added to aptos-stdlib/tests/, one actually related to math64, but the others parked there since
I can't find another place to put nontrivial move tests to be executed.
brmataptos added a commit that referenced this issue Jun 30, 2023
… inlined method.

Includes test case illustrating original bug (#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.
brmataptos added a commit that referenced this issue Jul 1, 2023
… inlined method.

Includes test case illustrating original bug (#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.
brmataptos added a commit that referenced this issue Jul 1, 2023
… inlined method.

Includes test case illustrating original bug (#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.
brmataptos added a commit that referenced this issue Jul 3, 2023
… inlined method.

Includes test case illustrating original bug (#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.
brmataptos added a commit that referenced this issue Jul 3, 2023
… inlined method.

Includes test case illustrating original bug (#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.
brmataptos added a commit that referenced this issue Jul 3, 2023
… inlined method. (#8867)

Includes test case illustrating original bug (#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.
@wrwg
Copy link
Contributor

wrwg commented Jul 5, 2023

Fixed

@wrwg wrwg closed this as completed Jul 5, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Move Language and Runtime Jul 5, 2023
wrwg pushed a commit to wrwg/move-lang that referenced this issue Jul 12, 2023
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
wrwg pushed a commit to move-language/move that referenced this issue Jul 12, 2023
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
gedigi pushed a commit that referenced this issue Aug 2, 2023
… inlined method. (#8867)

Includes test case illustrating original bug (#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.
vgao1996 pushed a commit to vgao1996/aptos-framework-test that referenced this issue Jun 26, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
vgao1996 pushed a commit to vgao1996/aptos-framework-test that referenced this issue Jun 26, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
vgao1996 pushed a commit to vgao1996/aptos-framework-test that referenced this issue Sep 16, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 8, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 23, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 24, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 30, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Oct 30, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Nov 14, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
aptos-bot pushed a commit to aptos-labs/aptos-framework that referenced this issue Dec 5, 2024
… inlined method. (#8867)

Includes test case illustrating original bug (aptos-labs/aptos-core#8516)
plus a number of tests to check corner cases of multiple inlining and recursive inlining.
(Several failed without this fix.)

Also replace panic!("ICE expected function parameter to be a lambda") with a more useful diag
output.

GitOrigin-RevId: ea19ce1b272e5e2e979057bd58990e76e6c4d03a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

5 participants