solidity/test/libsolidity/semanticTests/array/copying/copying_bytes_multiassign.sol
Nikola Matic fdc6699159 Rematerialize zero literals with default cleanup sequence
Add unused pruner step to the end of the default cleanup sequence
2023-09-04 15:40:33 +02:00

31 lines
896 B
Solidity

contract receiver {
uint public received;
function recv(uint x) public { received += x + 1; }
fallback() external { received = 0x80; }
}
contract sender {
constructor() { rec = new receiver(); }
fallback() external { savedData1 = savedData2 = msg.data; }
function forward(bool selector) public returns (bool) {
if (selector) { address(rec).call(savedData1); delete savedData1; }
else { address(rec).call(savedData2); delete savedData2; }
return true;
}
function val() public returns (uint) { return rec.received(); }
receiver rec;
bytes savedData1;
bytes savedData2;
}
// ----
// (): 7 ->
// gas irOptimized: 110831
// gas legacy: 111388
// gas legacyOptimized: 111065
// val() -> 0
// forward(bool): true -> true
// val() -> 0x80
// forward(bool): false -> true
// val() -> 0x80
// forward(bool): true -> true
// val() -> 0x80