Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Compiler Features:
* General: Remove support for the experimental EOF (EVM Object Format) backend.

Bugfixes:
* Codegen: Fix ICE when assigning a calldata struct containing a member of external function type to a storage struct.
* NatSpec: Disallow `@return` tag in event documentation.
* SMTChecker: Fix incorrect handling of constant operands of unary operations.

Expand Down
19 changes: 9 additions & 10 deletions libsolidity/codegen/YulUtilFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3798,16 +3798,15 @@ std::string YulUtilFunctions::copyStructToStorageFunction(StructType const& _fro
let memberSrcPtr := add(value, <memberOffset>)

<?fromCalldata>
let <memberValues> :=
<?dynamicallyEncodedMember>
<accessCalldataTail>(value, memberSrcPtr)
<!dynamicallyEncodedMember>
memberSrcPtr
</dynamicallyEncodedMember>

<?isValueType>
<memberValues> := <read>(<memberValues>)
</isValueType>
<?dynamicallyEncodedMember>
let <memberValues> := <accessCalldataTail>(value, memberSrcPtr)
<!dynamicallyEncodedMember>
<?isValueType>
let <memberValues> := <read>(memberSrcPtr)
<!isValueType>
let <memberValues> := memberSrcPtr
</isValueType>
</dynamicallyEncodedMember>
</fromCalldata>

<?fromMemory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ contract c {
// ----
// test((uint16,uint16,uint16[3],uint16[])): 0x20, 2, 3, 0, 0, 4, 0xC0, 4, 0, 0, 5, 0, 0 -> 2, 3, 4, 5
// gas irOptimized: 137153
// gas legacy: 142414
// gas legacy: 142398
// gas legacyOptimized: 137975
// gas ssaCFGOptimized: 136989
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pragma abicoder v2;
struct S {
function(uint) external fn_uint;
}

contract C {
S storageStruct;

function test(S calldata calldataStruct) public returns (bool) {
storageStruct = calldataStruct;

assert(storageStruct.fn_uint.address == address(bytes20("01234567890123456789")));
assert(storageStruct.fn_uint.selector == bytes4("abcd"));
return true;
}
}
// ----
// test((function)): "01234567890123456789abcd" -> true
2 changes: 1 addition & 1 deletion test/libsolidity/semanticTests/structs/copy_to_mapping.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ contract C {
// gas ssaCFGOptimized: 122611
// from_calldata((bytes,uint16[],uint16)): 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -> 0x20, 0x60, 0xa0, 21, 3, 0x666f6f0000000000000000000000000000000000000000000000000000000000, 2, 13, 14
// gas irOptimized: 114824
// gas legacy: 118207
// gas legacy: 118199
// gas legacyOptimized: 115327
// gas ssaCFGOptimized: 114700
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ contract C {
// ----
// f(uint32,(uint128,uint256[][2],uint32)): 55, 0x40, 77, 0x60, 88, 0x40, 0x40, 2, 1, 2 -> 55, 77, 1, 2, 88
// gas irOptimized: 202902
// gas legacy: 207376
// gas legacy: 207360
// gas legacyOptimized: 203583
// gas ssaCFGOptimized: 202897
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract C {
// s() -> 0, 0, 0x00, 0
// f((uint8,uint16,bytes2,uint8)): 1, 0xff, "ab", 15 ->
// gas irOptimized: 44237
// gas legacy: 47154
// gas legacy: 47122
// gas legacyOptimized: 44982
// s() -> 1, 0xff, 0x6162000000000000000000000000000000000000000000000000000000000000, 15
// g(uint16[]): 0x20, 3, 1, 2, 3 -> 0x20, 3, 1, 2, 3
Expand Down