Fix merge conflicts.

This commit is contained in:
chriseth 2020-11-17 18:59:15 +01:00
parent e8a278eefa
commit 691f7e6eae
6 changed files with 39 additions and 32 deletions

View File

@ -1825,7 +1825,7 @@ string YulUtilFunctions::copyValueArrayStorageToStorageFunction(ArrayType const&
if (_toType.isDynamicallySized())
templ("resizeArray", resizeDynamicArrayFunction(_toType));
templ("arrayLength",arrayLengthFunction(_fromType));
templ("panic", panicFunction());
templ("panic", panicFunction(PanicCode::ResourceError));
templ("srcDataLocation", arrayDataAreaFunction(_fromType));
templ("dstDataLocation", arrayDataAreaFunction(_toType));
unsigned itemsPerSlot = 32 / _toType.storageStride();
@ -2421,7 +2421,7 @@ string YulUtilFunctions::updateStorageValueFunction(
)");
templ("functionName", functionName);
templ("dynamicOffset", !_offset.has_value());
templ("panic", panicFunction());
templ("panic", panicFunction(PanicCode::Generic));
templ("value", suffixedVariableNameList("value_", 0, _fromType.sizeOnStack()));
templ("copyArrayToStorage", copyArrayToStorageFunction(
dynamic_cast<ArrayType const&>(_fromType),
@ -2452,7 +2452,7 @@ string YulUtilFunctions::updateStorageValueFunction(
)");
templ("functionName", functionName);
templ("dynamicOffset", !_offset.has_value());
templ("panic", panicFunction());
templ("panic", panicFunction(PanicCode::Generic));
templ("fromStorage", fromStructType.dataStoredIn(DataLocation::Storage));
MemberList::MemberMap structMembers = fromStructType.nativeMembers(nullptr);

View File

@ -57,23 +57,23 @@ object \"C_2\" {
*******************************************************/
object \"D_13\" {
object \"D_15\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
constructor_D_13()
constructor_D_15()
codecopy(0, dataoffset(\"D_13_deployed\"), datasize(\"D_13_deployed\"))
codecopy(0, dataoffset(\"D_15_deployed\"), datasize(\"D_15_deployed\"))
return(0, datasize(\"D_13_deployed\"))
return(0, datasize(\"D_15_deployed\"))
function constructor_D_13() {
function constructor_D_15() {
}
}
object \"D_13_deployed\" {
object \"D_15_deployed\" {
code {
mstore(64, 128)
@ -87,7 +87,7 @@ object \"D_13\" {
// f()
if callvalue() { revert(0, 0) }
abi_decode_tuple_(4, calldatasize())
fun_f_12()
fun_f_14()
let memPos := allocateMemory(0)
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
@ -112,7 +112,7 @@ object \"D_13\" {
memPtr := mload(64)
let newFreePtr := add(memPtr, size)
// protect against overflow
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }
mstore(64, newFreePtr)
}
@ -120,23 +120,25 @@ object \"D_13\" {
memPtr := mload(64)
}
function fun_f_12() {
function fun_f_14() {
let _1 := allocateTemporaryMemory()
let _2 := add(_1, datasize(\"C_2\"))
if or(gt(_2, 0xffffffffffffffff), lt(_2, _1)) { panic_error() }
if or(gt(_2, 0xffffffffffffffff), lt(_2, _1)) { panic_error_0x41() }
datacopy(_1, dataoffset(\"C_2\"), datasize(\"C_2\"))
_2 := abi_encode_tuple__to__fromStack(_2)
let expr_9_address := create(0, _1, sub(_2, _1))
let expr_11_address := create(0, _1, sub(_2, _1))
releaseTemporaryMemory()
let vloc_c_6_address := expr_9_address
let vloc_c_7_address := expr_11_address
}
function panic_error() {
invalid()
function panic_error_0x41() {
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
mstore(4, 0x41)
revert(0, 0x24)
}
function releaseTemporaryMemory() {

View File

@ -35,7 +35,7 @@ object "C_2" {
======= viair_subobjects/input.sol:D =======
Binary:
608060405234156100105760006000fd5b60d380610020600039806000f350fe6080604052600436101515610074576000803560e01c6326121ff0141561007257341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005757fe5b50806100ab60803980608083f05050806100708261007e565bf35b505b60006000fd6100a9565b6000604051905081810181811067ffffffffffffffff8211171561009e57fe5b80604052505b919050565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd
608060405234156100105760006000fd5b60f980610020600039806000f350fe608060405260043610151561007b576000803560e01c6326121ff0141561007957341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100b7565b5b50806100d160803980608083f050508061007782610085565bf35b505b60006000fd6100cf565b6000604051905081810181811067ffffffffffffffff821117156100ac576100ab6100b7565b5b80604052505b919050565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd
Binary of the runtime part:
Optimized IR:
@ -46,17 +46,17 @@ Optimized IR:
* !USE AT YOUR OWN RISK! *
*******************************************************/
object "D_13" {
object "D_15" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("D_13_deployed")
codecopy(0, dataoffset("D_13_deployed"), _1)
let _1 := datasize("D_15_deployed")
codecopy(0, dataoffset("D_15_deployed"), _1)
return(0, _1)
}
}
object "D_13_deployed" {
object "D_15_deployed" {
code {
{
mstore(64, 128)
@ -69,7 +69,7 @@ object "D_13" {
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
let _2 := datasize("C_2")
let _3 := add(128, _2)
if or(gt(_3, 0xffffffffffffffff), lt(_3, 128)) { invalid() }
if or(gt(_3, 0xffffffffffffffff), lt(_3, 128)) { panic_error_0x41() }
datacopy(128, dataoffset("C_2"), _2)
pop(create(_1, 128, _2))
return(allocateMemory(_1), _1)
@ -81,9 +81,15 @@ object "D_13" {
{
memPtr := mload(64)
let newFreePtr := add(memPtr, size)
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() }
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }
mstore(64, newFreePtr)
}
function panic_error_0x41()
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 0x41)
revert(0, 0x24)
}
}
object "C_2" {
code {
@ -106,4 +112,3 @@ object "D_13" {
}
}
}

View File

@ -33,6 +33,6 @@ contract C {
// reenc(uint256[][2],uint256,uint256): 0x60, 1, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> 0x0B03
// test(uint256[][2],uint256,uint256): 0x60, 1, 3, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> 0x0B04
// reenc(uint256[][2],uint256,uint256): 0x60, 1, 3, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> 0x0B04
// test(uint256[][2],uint256,uint256): 0x60, 0, 3, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE
// test(uint256[][2],uint256,uint256): 0x60, 1, 4, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE
// test(uint256[][2],uint256): 0x40, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE
// test(uint256[][2],uint256,uint256): 0x60, 0, 3, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE, hex"4e487b71", 0x32
// test(uint256[][2],uint256,uint256): 0x60, 1, 4, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE, hex"4e487b71", 0x32
// test(uint256[][2],uint256): 0x40, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE, hex"4e487b71", 0x32

View File

@ -33,6 +33,6 @@ contract C {
// reenc(uint256[][],uint256,uint256): 0x60, 1, 2, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> 0x0B03
// test(uint256[][],uint256,uint256): 0x60, 1, 3, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> 0x0B04
// reenc(uint256[][],uint256,uint256): 0x60, 1, 3, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> 0x0B04
// test(uint256[][],uint256,uint256): 0x60, 0, 3, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE
// test(uint256[][],uint256,uint256): 0x60, 1, 4, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE
// test(uint256[][],uint256): 0x40, 2, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE
// test(uint256[][],uint256,uint256): 0x60, 0, 3, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE, hex"4e487b71", 0x32
// test(uint256[][],uint256,uint256): 0x60, 1, 4, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE, hex"4e487b71", 0x32
// test(uint256[][],uint256): 0x40, 2, 2, 0x40, 0xC0, 3, 0x0A01, 0x0A02, 0x0A03, 4, 0x0B01, 0x0B02, 0x0B03, 0x0B04 -> FAILURE, hex"4e487b71", 0x32

View File

@ -9,4 +9,4 @@ contract C {
// ----
// f(bytes[],uint256): 0x40, 0, 1, 0x20, 2, 0x6162000000000000000000000000000000000000000000000000000000000000 -> 0x61
// f(bytes[],uint256): 0x40, 1, 1, 0x20, 2, 0x6162000000000000000000000000000000000000000000000000000000000000 -> 0x62
// f(bytes[],uint256): 0x40, 2, 1, 0x20, 2, 0x6162000000000000000000000000000000000000000000000000000000000000 -> FAILURE
// f(bytes[],uint256): 0x40, 2, 1, 0x20, 2, 0x6162000000000000000000000000000000000000000000000000000000000000 -> FAILURE, hex"4e487b71", 0x32