Merge remote-tracking branch 'origin/develop' into breaking

This commit is contained in:
chriseth
2020-11-03 14:05:14 +01:00
206 changed files with 1420 additions and 862 deletions
@@ -6,5 +6,7 @@ contract C {
return s[0];
}
}
// ====
// compileViaYul: also
// ----
// f() -> "a"
@@ -5,5 +5,7 @@ contract C {
return s[0];
}
}
// ====
// compileViaYul: also
// ----
// f(bytes): 0x20, 0x08, "abcdefgh" -> "a"
@@ -0,0 +1,42 @@
pragma experimental ABIEncoderV2;
struct S {
uint16 x;
bytes a;
uint16 y;
bytes b;
}
contract C {
uint padding;
S data;
function f() public returns (bytes memory, bytes memory) {
S memory x;
x.x = 7;
x.b = "1234567890123456789012345678901 1234567890123456789012345678901 123456789";
x.a = "abcdef";
x.y = 9;
data = x;
return (data.a, data.b);
}
function g() public returns (bytes memory, bytes memory) {
S memory x;
x.x = 7;
x.b = "12345678923456789";
x.a = "1234567890123456789012345678901 1234567890123456789012345678901 123456789";
x.y = 9;
data = x;
return (data.a, data.b);
}
function h() public returns (bytes memory, bytes memory) {
S memory x;
data = x;
return (data.a, data.b);
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x40, 0x80, 6, 0x6162636465660000000000000000000000000000000000000000000000000000, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000
// g() -> 0x40, 0xc0, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000, 0x11, 0x3132333435363738393233343536373839000000000000000000000000000000
// h() -> 0x40, 0x60, 0x00, 0x00
// storage: empty
@@ -0,0 +1,50 @@
function dataslot() pure returns (bytes32) {
return keccak256(abi.encode(1));
}
function readDataSlot(uint offset) view returns (bytes32 r) {
bytes32 s = dataslot();
assembly { r := sload(add(s, offset)) }
}
function readDataSlot() view returns (bytes32) {
return readDataSlot(0);
}
function readHead() view returns (bytes32 r) {
assembly { r := sload(1) }
}
contract C {
uint padding;
bytes data;
function f() public returns (uint) {
bytes32 zero;
if (!(readDataSlot() == zero)) return 1;
data = "abc";
if (!(readDataSlot() == zero)) return 2;
data = "1234567890123456789012345678901234567890123456789012345678901234567890";
if (!(readDataSlot() != zero)) return 3;
if (!(readDataSlot(1) != zero)) return 4;
if (!(readDataSlot(2) != zero)) return 5;
if (!(readDataSlot(3) == zero)) return 6;
if (!(readDataSlot(4) == zero)) return 7;
data = "abc";
if (!(readDataSlot() == zero)) return 8;
if (!(readDataSlot(1) == zero)) return 9;
if (!(readDataSlot(2) == zero)) return 10;
if (!(readDataSlot(3) == zero)) return 11;
data = "1234567890123456789012345678901234567890123456789012345678901234567890";
data = "123456789012345678901234567890123456";
if (!(readDataSlot() != zero)) return 12;
if (!(readDataSlot(1) != zero)) return 13;
if (!(readDataSlot(2) == zero)) return 14;
if (!(readDataSlot(3) == zero)) return 15;
return 0xff;
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0xff
@@ -17,6 +17,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// one() -> 3
// two() -> FAILURE, hex"4e487b71", 0x51