mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[Sol->Yul] Fixing array clearing when copying from storage to storage.
This commit is contained in:
@@ -17,5 +17,7 @@ contract c {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000
|
||||
|
||||
+2
@@ -15,5 +15,7 @@ contract c {
|
||||
y = data2[4];
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 5, 4
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
contract C {
|
||||
bytes1[2] data1;
|
||||
bytes2[2] data2;
|
||||
function test() public returns (bytes2, bytes2) {
|
||||
uint i;
|
||||
for (i = 0; i < data1.length; ++i)
|
||||
data1[i] = bytes1(uint8(1 + i));
|
||||
data2 = data1;
|
||||
return (data2[0], data2[1]);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> left(0x01), left(0x02)
|
||||
@@ -15,5 +15,7 @@ contract c {
|
||||
res2 |= uint(uint16(data2[16 + i])) * 0x10000**i;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0xffffffff, 0x0000000000000000000000000a00090008000700060005000400030002000100, 0x0000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
@@ -17,6 +17,7 @@ contract c {
|
||||
r3 = data2[5];
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0x04000000000000000000000000000000000000000000000000, 0x0, 0x0
|
||||
|
||||
@@ -17,5 +17,7 @@ contract c {
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x0
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
contract c {
|
||||
bytes9[7] data1; // 3 per slot
|
||||
bytes32[10] data2; // 1 per slot
|
||||
|
||||
function test()
|
||||
public
|
||||
returns (bytes32 a, bytes32 b, bytes32 c, bytes32 d, bytes32 e)
|
||||
{
|
||||
for (uint256 i = 0; i < data1.length; ++i) data1[i] = bytes8(uint64(i));
|
||||
data2[8] = data2[9] = bytes8(uint64(2));
|
||||
data2 = data1;
|
||||
a = data2[1];
|
||||
b = data2[2];
|
||||
c = data2[3];
|
||||
d = data2[4];
|
||||
e = data2[9];
|
||||
}
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x00
|
||||
Reference in New Issue
Block a user