crytic / crytic/slither

[Bug]: No tuple variable assigned when call destination is compound expression

Open
#1,923 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

When I invoke a multi-return method on a cast expression, the generated IR does not contain a `HighLevelCall` operation to initialize a tuple variable.

I think this only happens if the method has at least one parameter.

### Code example to reproduce the issue:

```
pragma solidity ^0.8.19;

interface ISomeInterface {
function value(uint z) external returns (uint, uint);
}

contract Test {

function test(address a) external {
(uint256 w, uint256 x) = ISomeInterface(a).value(3);
}
}
```

### Version:

0.9.3

### Relevant log output:

```shell
INFO:Printers:Contract ISomeInterface
Function ISomeInterface.value(uint256) (*)
Contract Test
Function Test.test(address) (*)
Expression: (w,x) = ISomeInterface(a).value(3)
IRs:
TMP_0 = CONVERT a to ISomeInterface
w(uint256)= UNPACK TUPLE_0 index: 0
x(uint256)= UNPACK TUPLE_0 index: 1
Expression: ()
IRs:
RETURN
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the Solidity example and inspecting the generated IR for the missing HighLevelCall operation. Trace how the cast expression and parameterized multi-return call are lowered, then verify that the tuple variable is initialized and the existing UNPACK operations remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, solidity
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.