Fix IR bug on deleting storage variables of function type.

Calling the zeroing function assumed that the stack slots needed for the type was always 1. This is
false for function types.
This commit is contained in:
hrkrshnn
2021-02-24 12:43:33 +01:00
parent 6fd5ea01d1
commit 2c2c7a4473
2 changed files with 42 additions and 1 deletions
+3 -1
View File
@@ -3888,11 +3888,13 @@ string YulUtilFunctions::storageSetToZeroFunction(Type const& _type)
if (_type.isValueType())
return Whiskers(R"(
function <functionName>(slot, offset) {
<store>(slot, offset, <zeroValue>())
let <values> := <zeroValue>()
<store>(slot, offset, <values>)
}
)")
("functionName", functionName)
("store", updateStorageValueFunction(_type, _type))
("values", suffixedVariableNameList("zero_", 0, _type.sizeOnStack()))
("zeroValue", zeroValueFunction(_type))
.render();
else if (_type.category() == Type::Category::Array)