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]: Incorrect slithir when assigning to a shadowed variable the result of a function call with multiple return variables #1867

Closed
smonicas opened this issue Apr 26, 2023 · 0 comments
Labels
bug Something isn't working ir

Comments

@smonicas
Copy link
Contributor

smonicas commented Apr 26, 2023

Describe the issue:

Slithir for function a, when only a single returned variable is used

Function T.a(Foo) (*)
	Expression: (bb) = bb.foo4(342)
	IRs:
		TUPLE_1(uint256,uint256,uint256,uint256) = HIGH_LEVEL_CALL, dest:bb(Foo), function:foo4, arguments:['342']  
		bb(Foo) := TUPLE_1([<slither.core.solidity_types.elementary_type.ElementaryType object at 0x106482040>, <slither.core.solidity_types.elementary_type.ElementaryType object at 0x1064827f0>, <slither.core.solidity_types.elementary_type.ElementaryType object at 0x106482130>, <slither.core.solidity_types.elementary_type.ElementaryType object at 0x1064820a0>])

Slithir for function b, when multiple returned variables are used

Function T.b(Foo) (*)
	Expression: (bb,cc) = bb.foo4(342)
	IRs:
		TUPLE_1(uint256,uint256,uint256,uint256) = HIGH_LEVEL_CALL, dest:bb(Foo), function:foo4, arguments:['342']  
		bb(Foo)= UNPACK TUPLE_1 index: 0 
		cc(uint256)= UNPACK TUPLE_1 index: 2 

Code example to reproduce the issue:

pragma solidity 0.8.19;

interface Foo {
 function foo4(uint r) external returns(uint, uint, uint, uint);
}

contract T {
  function a(Foo bb) public {
    (,uint bb,,)= bb.foo4(342);
  }

  function b(Foo bb) public {
    (,uint bb,uint cc,)= bb.foo4(342);
  }
}

Version:

0.9.3

Relevant log output:

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ir
Projects
None yet
Development

No branches or pull requests

1 participant