-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a ICE on calldata to struct member copy
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
test/libsolidity/semanticTests/structs/msg_data_to_struct_member_copy.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
struct St0 { | ||
bytes el0; | ||
} | ||
contract C { | ||
function f() external returns (St0 memory) { | ||
St0 memory x; | ||
x.el0 = msg.data; | ||
return x; | ||
} | ||
|
||
function g() external returns (St0 memory) { | ||
bytes memory temp = msg.data; | ||
St0 memory x; | ||
x.el0 = temp; | ||
return x; | ||
} | ||
|
||
function hashes() external returns (bytes4, bytes4) { | ||
return (this.f.selector, this.g.selector); | ||
} | ||
|
||
function large(uint256, uint256, uint256, uint256) external returns (St0 memory) { | ||
St0 memory x; | ||
x.el0 = msg.data; | ||
return x; | ||
} | ||
|
||
function another_large(uint256, uint256, uint256, uint256) external returns (St0 memory) { | ||
bytes memory temp = msg.data; | ||
St0 memory x; | ||
x.el0 = temp; | ||
return x; | ||
} | ||
|
||
} | ||
// ==== | ||
// compileToEwasm: also | ||
// compileViaYul: also | ||
// ---- | ||
// f() -> 0x20, 0x20, 4, 0x26121ff000000000000000000000000000000000000000000000000000000000 | ||
// g() -> 0x20, 0x20, 4, 0xe2179b8e00000000000000000000000000000000000000000000000000000000 | ||
// hashes() -> 0x26121ff000000000000000000000000000000000000000000000000000000000, 0xe2179b8e00000000000000000000000000000000000000000000000000000000 | ||
// large(uint256,uint256,uint256,uint256): 1, 2, 3, 4 -> 0x20, 0x20, 0x84, 0xe02492f800000000000000000000000000000000000000000000000000000000, 0x100000000000000000000000000000000000000000000000000000000, 0x200000000000000000000000000000000000000000000000000000000, 0x300000000000000000000000000000000000000000000000000000000, 0x400000000000000000000000000000000000000000000000000000000 | ||
// another_large(uint256,uint256,uint256,uint256): 1, 2, 3, 4 -> 0x20, 0x20, 0x84, 0x2a46f85a00000000000000000000000000000000000000000000000000000000, 0x100000000000000000000000000000000000000000000000000000000, 0x200000000000000000000000000000000000000000000000000000000, 0x300000000000000000000000000000000000000000000000000000000, 0x400000000000000000000000000000000000000000000000000000000 |