You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compiler gives an error InternalCompilerError: Invalid stack item name: slot when compiling with --via-ir,
when an assembly block calls .slot on a reference to a mapping.
Environment
Compiler version: 0.8.15
Steps to Reproduce
Found in ERC721A, when compiling with --via-ir
function _getApprovedAddress(uint256tokenId)
privateviewreturns (uint256approvedAddressSlot, addressapprovedAddress)
{
mapping(uint256=>address) storage tokenApprovalsPtr = _tokenApprovals;
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`.assembly {
// Compute the slot.mstore(0x00, tokenId)
mstore(0x20, tokenApprovalsPtr.slot) // This line causes the compiler error.
approvedAddressSlot :=keccak256(0x00, 0x40)
// Load the slot's value from storage.
approvedAddress :=sload(approvedAddressSlot)
}
}
Description
Compiler gives an error
InternalCompilerError: Invalid stack item name: slot
when compiling with--via-ir
,when an assembly block calls
.slot
on a reference to a mapping.Environment
Steps to Reproduce
Found in ERC721A, when compiling with
--via-ir
The code compiles normally without
--via-ir
.See: chiru-labs/ERC721A#364
The text was updated successfully, but these errors were encountered: