Skip to content

Commit

Permalink
Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Oct 13, 2020
1 parent caefe1c commit 23e0f55
Show file tree
Hide file tree
Showing 86 changed files with 380 additions and 323 deletions.
22 changes: 15 additions & 7 deletions test/cmdlineTests/exp_base_literal/output
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ object "C_80" {
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_65() }
mstore(64, newFreePtr)
}

Expand All @@ -116,15 +116,15 @@ object "C_80" {
function checked_exp_t_rational_10_by_1_t_uint256(exponent) -> power {
exponent := cleanup_t_uint256(exponent)

if gt(exponent, 77) { panic_error() }
if gt(exponent, 77) { panic_error_17() }

power := exp(10, exponent)
}

function checked_exp_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_t_uint256(exponent) -> power {
exponent := cleanup_t_uint256(exponent)

if gt(exponent, 1) { panic_error() }
if gt(exponent, 1) { panic_error_17() }

power := exp(115792089237316195423570985008687907853269984665640564039457584007913129639935, exponent)
}
Expand All @@ -138,7 +138,7 @@ object "C_80" {
function checked_exp_t_rational_2_by_1_t_uint256(exponent) -> power {
exponent := cleanup_t_uint256(exponent)

if gt(exponent, 255) { panic_error() }
if gt(exponent, 255) { panic_error_17() }

power := exp(2, exponent)
}
Expand All @@ -152,7 +152,7 @@ object "C_80" {
function checked_exp_t_rational_minus_2_by_1_t_uint256(exponent) -> power {
exponent := cleanup_t_uint256(exponent)

if gt(exponent, 255) { panic_error() }
if gt(exponent, 255) { panic_error_17() }

power := exp(115792089237316195423570985008687907853269984665640564039457584007913129639934, exponent)
}
Expand Down Expand Up @@ -274,8 +274,16 @@ object "C_80" {

}

function panic_error() {
invalid()
function panic_error_17() {
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
mstore(4, 17)
revert(0, 0x24)
}

function panic_error_65() {
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
mstore(4, 65)
revert(0, 0x24)
}

function shift_right_224_unsigned(value) -> newValue {
Expand Down
10 changes: 8 additions & 2 deletions test/cmdlineTests/ir_compiler_subobjects/output
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object "D_15" {
if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) }
let _3 := datasize("C_2")
let _4 := add(_1, _3)
if or(gt(_4, 0xffffffffffffffff), lt(_4, _1)) { invalid() }
if or(gt(_4, 0xffffffffffffffff), lt(_4, _1)) { panic_error_65() }
datacopy(_1, dataoffset("C_2"), _3)
pop(create(_2, _1, sub(_4, _1)))
return(allocateMemory(_2), _2)
Expand All @@ -70,9 +70,15 @@ object "D_15" {
{
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_65() }
mstore(64, newFreePtr)
}
function panic_error_65()
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 65)
revert(0, 0x24)
}
}
object "C_2" {
code {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ object "D_11" {
{
if callvalue() { revert(_2, _2) }
if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) }
if gt(_1, 0xffffffffffffffff) { invalid() }
if gt(_1, 0xffffffffffffffff)
{
mstore(_2, shl(224, 0x4e487b71))
mstore(4, 65)
revert(_2, 0x24)
}
mstore(64, _1)
return(_1, _2)
}
Expand Down
45 changes: 28 additions & 17 deletions test/cmdlineTests/name_simplifier/output
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object "C_59" {
if gt(offset, _3) { revert(_1, _1) }
if iszero(slt(add(offset, 35), calldatasize())) { revert(_1, _1) }
let length := calldataload(add(4, offset))
if gt(length, _3) { invalid() }
if gt(length, _3) { panic_error_65() }
let _4 := mul(length, _2)
let dst := allocateMemory(add(_4, _2))
let dst_1 := dst
Expand All @@ -60,7 +60,7 @@ object "C_59" {
if slt(sub(end, headStart), 0x20) { revert(value, value) }
let memPtr := mload(64)
let newFreePtr := add(memPtr, 0x20)
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() }
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_65() }
mstore(64, newFreePtr)
value := memPtr
mstore(memPtr, calldataload(headStart))
Expand All @@ -87,14 +87,14 @@ object "C_59" {
{
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_65() }
mstore(64, newFreePtr)
}
function convert_t_stringliteral_6490_to_t_string() -> converted
{
let memPtr := mload(64)
let newFreePtr := add(memPtr, 160)
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() }
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_65() }
mstore(64, newFreePtr)
converted := memPtr
mstore(memPtr, 100)
Expand All @@ -109,26 +109,37 @@ object "C_59" {
}
function fun_sumArray_58(vloc__s_22_mpos) -> vloc, vloc__27_mpos
{
let _1 := mload(vloc__s_22_mpos)
if iszero(lt(vloc, _1)) { invalid() }
let _2 := mload(mload(add(add(vloc__s_22_mpos, mul(vloc, 32)), 32)))
let _3, _4 := storage_array_index_access$_t_struct$_S_storage(vloc, vloc)
sstore(_3, _2)
if iszero(lt(0x01, _1)) { invalid() }
let _5 := mload(mload(add(vloc__s_22_mpos, 64)))
if iszero(lt(vloc, 0x02)) { invalid() }
if iszero(lt(vloc, mload(vloc__s_22_mpos))) { panic_error_50() }
let _1 := mload(mload(add(add(vloc__s_22_mpos, mul(vloc, 32)), 32)))
let _2, _3 := storage_array_index_access$_t_struct$_S_storage(vloc, vloc)
sstore(_2, _1)
if iszero(lt(0x01, mload(vloc__s_22_mpos))) { panic_error_50() }
let _4 := mload(mload(add(vloc__s_22_mpos, 64)))
if iszero(lt(vloc, 0x02)) { panic_error_50() }
let slot := add(0x02, vloc)
let _6 := sload(slot)
let _5 := sload(slot)
let shiftBits := mul(vloc, 8)
let mask := shl(shiftBits, not(0))
sstore(slot, or(and(_6, not(mask)), and(shl(shiftBits, _5), mask)))
let _7, _8 := storage_array_index_access$_t_struct$_S_storage(0x02, vloc)
vloc := extract_from_storage_value_dynamict_uint256(sload(_7), _8)
sstore(slot, or(and(_5, not(mask)), and(shl(shiftBits, _4), mask)))
let _6, _7 := storage_array_index_access$_t_struct$_S_storage(0x02, vloc)
vloc := extract_from_storage_value_dynamict_uint256(sload(_6), _7)
vloc__27_mpos := convert_t_stringliteral_6490_to_t_string()
}
function panic_error_50()
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 50)
revert(0, 0x24)
}
function panic_error_65()
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 65)
revert(0, 0x24)
}
function storage_array_index_access$_t_struct$_S_storage(array, index) -> slot, offset
{
if iszero(lt(index, 0x02)) { invalid() }
if iszero(lt(index, 0x02)) { panic_error_50() }
slot := add(array, index)
offset := offset
}
Expand Down
24 changes: 19 additions & 5 deletions test/cmdlineTests/optimizer_array_sload/output
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ object "Arraysum_33" {
for { }
lt(vloc_i, _2)
{
if gt(vloc_i, not(1)) { invalid() }
if gt(vloc_i, not(1)) { panic_error_17() }
vloc_i := add(vloc_i, 1)
}
{
mstore(_1, _1)
let _3 := sload(add(keccak256(_1, 0x20), vloc_i))
if gt(vloc_sum, not(_3)) { invalid() }
vloc_sum := add(vloc_sum, _3)
vloc_sum := checked_add_t_uint256(vloc_sum, sload(add(keccak256(_1, 0x20), vloc_i)))
}
let memPos := allocateMemory(_1)
return(memPos, sub(abi_encode_uint(memPos, _1), memPos))
Expand All @@ -57,9 +55,25 @@ object "Arraysum_33" {
{
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))
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 65)
revert(0, 0x24)
}
mstore(64, newFreePtr)
}
function checked_add_t_uint256(x, y) -> sum
{
if gt(x, not(y)) { panic_error_17() }
sum := add(x, y)
}
function panic_error_17()
{
mstore(0, shl(224, 0x4e487b71))
mstore(4, 17)
revert(0, 0x24)
}
}
}
}
14 changes: 8 additions & 6 deletions test/cmdlineTests/standard_generatedSources/output.json

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions test/cmdlineTests/standard_irOptimized_requested/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ object \"C_6\" {
{
memPtr := mload(64)
let newFreePtr := add(memPtr, size)
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_65() }
mstore(64, newFreePtr)
}
function fun_f_5()
{ }
function panic_error()
{ invalid() }
function panic_error_65()
{
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
mstore(4, 65)
revert(0, 0x24)
}
function shift_right_224_unsigned(value) -> newValue
{ newValue := shr(224, value) }
}
Expand Down
8 changes: 5 additions & 3 deletions test/cmdlineTests/standard_ir_requested/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,18 @@ object \"C_6\" {
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_65() }
mstore(64, newFreePtr)
}

function fun_f_5() {

}

function panic_error() {
invalid()
function panic_error_65() {
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
mstore(4, 65)
revert(0, 0x24)
}

function shift_right_224_unsigned(value) -> newValue {
Expand Down
Loading

0 comments on commit 23e0f55

Please sign in to comment.