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

InferTypes crashes on unbalanced tuple assignments in 0.4.x #156

Open
cd1m0 opened this issue Oct 12, 2022 · 0 comments
Open

InferTypes crashes on unbalanced tuple assignments in 0.4.x #156

cd1m0 opened this issue Oct 12, 2022 · 0 comments
Assignees
Labels
bug Something isn't working cac Issue discovered from running over the contract archive

Comments

@cd1m0
Copy link
Contributor

cd1m0 commented Oct 12, 2022

In 0.4.x apparently its possible to do a tuple assignment where the LHS has one fewer components than the RHS. E.g.

contract Foo {
  function main() public returns (uint, uint) {
    uint a;
    uint c;
    uint d;
    (,c,d) = (1,2);

    return (c,d);
  }
}

Running this code returns (1,2) so it seems that the compiler is ignoring the first unnamed tuple component. There is an error if the component is named (e.g. (a,c,d)) or on any compiler after 0.5.0. Since this kinda looks like a very old compiler bug, its a rare behavior (seen 3 times over 75K contracts) might not even fix this crash. Just marking it so we don't loose track.

@cd1m0 cd1m0 added the bug Something isn't working label Oct 12, 2022
@cd1m0 cd1m0 self-assigned this Oct 12, 2022
@cd1m0 cd1m0 added the cac Issue discovered from running over the contract archive label Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cac Issue discovered from running over the contract archive
Projects
None yet
Development

No branches or pull requests

1 participant