Describe the issue:
The SlithIR incorrectly executes side effects like ++index before capturing right-hand side tuple values for assignment, causing (a, b) = (index, ++index) to produce a = 1 in the IR instead of the correct a = 0.
Code example to reproduce the issue:
pragma solidity ^0.8.0;
contract Test {
uint256 public index = 0;
uint256 public a;
uint256 public b;
function foo() public {
require(index == 0);
(a, b) = (index, ++index);
}
}
Version:
0.11.3
Relevant log output:
┌─ Node ID: 2
│ Expression: (a,b) = (index,++ index)
│ Type: NodeType.EXPRESSION
│ IRs:
│ 1. index(uint256) = index (c)+ 1
│ Type: Binary
│ 2. a(uint256) := index(uint256)
│ Type: Assignment
│ 3. b(uint256) := index(uint256)
│ Type: Assignment
└─
Describe the issue:
The SlithIR incorrectly executes side effects like
++indexbefore capturing right-hand side tuple values for assignment, causing(a, b) = (index, ++index)to producea = 1in the IR instead of the correcta = 0.Code example to reproduce the issue:
Version:
0.11.3
Relevant log output:
┌─ Node ID: 2 │ Expression: (a,b) = (index,++ index) │ Type: NodeType.EXPRESSION │ IRs: │ 1. index(uint256) = index (c)+ 1 │ Type: Binary │ 2. a(uint256) := index(uint256) │ Type: Assignment │ 3. b(uint256) := index(uint256) │ Type: Assignment └─