Update existing tests.

This commit is contained in:
chriseth 2020-09-15 16:16:30 +02:00
parent 33d8b62d06
commit e61fa59593
35 changed files with 147 additions and 118 deletions

View File

@ -33,7 +33,7 @@ object "Arraysum_33" {
for { } for { }
lt(vloc_i, _2) lt(vloc_i, _2)
{ {
if gt(vloc_i, not(1)) { invalid() } if eq(vloc_i, not(0)) { invalid() }
vloc_i := add(vloc_i, 1) vloc_i := add(vloc_i, 1)
} }
{ {

View File

@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE(function_calls)
uint data2; uint data2;
function f(uint x) public { function f(uint x) public {
if (x > 7) if (x > 7)
data2 = g(x**8) + 1; { unchecked { data2 = g(x**8) + 1; } }
else else
data = 1; data = 1;
} }
@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE(multiple_external_functions)
uint data2; uint data2;
function f(uint x) public { function f(uint x) public {
if (x > 7) if (x > 7)
data2 = g(x**8) + 1; { unchecked { data2 = g(x**8) + 1; } }
else else
data = 1; data = 1;
} }
@ -223,13 +223,13 @@ BOOST_AUTO_TEST_CASE(exponent_size)
char const* sourceCode = R"( char const* sourceCode = R"(
contract A { contract A {
function f(uint x) public returns (uint) { function f(uint x) public returns (uint) {
return x ** 0; unchecked { return x ** 0; }
} }
function g(uint x) public returns (uint) { function g(uint x) public returns (uint) {
return x ** 0x100; unchecked { return x ** 0x100; }
} }
function h(uint x) public returns (uint) { function h(uint x) public returns (uint) {
return x ** 0x10000; unchecked { return x ** 0x10000; }
} }
} }
)"; )";
@ -289,29 +289,31 @@ BOOST_AUTO_TEST_CASE(complex_control_flow)
char const* sourceCode = R"( char const* sourceCode = R"(
contract log { contract log {
function ln(int128 x) public pure returns (int128 result) { function ln(int128 x) public pure returns (int128 result) {
int128 t = x / 256; unchecked {
int128 y = 5545177; int128 t = x / 256;
x = t; int128 y = 5545177;
t = x * 16; if (t <= 1000000) { x = t; y = y - 2772588; } x = t;
t = x * 4; if (t <= 1000000) { x = t; y = y - 1386294; } t = x * 16; if (t <= 1000000) { x = t; y = y - 2772588; }
t = x * 2; if (t <= 1000000) { x = t; y = y - 693147; } t = x * 4; if (t <= 1000000) { x = t; y = y - 1386294; }
t = x + x / 2; if (t <= 1000000) { x = t; y = y - 405465; } t = x * 2; if (t <= 1000000) { x = t; y = y - 693147; }
t = x + x / 4; if (t <= 1000000) { x = t; y = y - 223144; } t = x + x / 2; if (t <= 1000000) { x = t; y = y - 405465; }
t = x + x / 8; if (t <= 1000000) { x = t; y = y - 117783; } t = x + x / 4; if (t <= 1000000) { x = t; y = y - 223144; }
t = x + x / 16; if (t <= 1000000) { x = t; y = y - 60624; } t = x + x / 8; if (t <= 1000000) { x = t; y = y - 117783; }
t = x + x / 32; if (t <= 1000000) { x = t; y = y - 30771; } t = x + x / 16; if (t <= 1000000) { x = t; y = y - 60624; }
t = x + x / 64; if (t <= 1000000) { x = t; y = y - 15504; } t = x + x / 32; if (t <= 1000000) { x = t; y = y - 30771; }
t = x + x / 128; if (t <= 1000000) { x = t; y = y - 7782; } t = x + x / 64; if (t <= 1000000) { x = t; y = y - 15504; }
t = x + x / 256; if (t <= 1000000) { x = t; y = y - 3898; } t = x + x / 128; if (t <= 1000000) { x = t; y = y - 7782; }
t = x + x / 512; if (t <= 1000000) { x = t; y = y - 1951; } t = x + x / 256; if (t <= 1000000) { x = t; y = y - 3898; }
t = x + x / 1024; if (t <= 1000000) { x = t; y = y - 976; } t = x + x / 512; if (t <= 1000000) { x = t; y = y - 1951; }
t = x + x / 2048; if (t <= 1000000) { x = t; y = y - 488; } t = x + x / 1024; if (t <= 1000000) { x = t; y = y - 976; }
t = x + x / 4096; if (t <= 1000000) { x = t; y = y - 244; } t = x + x / 2048; if (t <= 1000000) { x = t; y = y - 488; }
t = x + x / 8192; if (t <= 1000000) { x = t; y = y - 122; } t = x + x / 4096; if (t <= 1000000) { x = t; y = y - 244; }
t = x + x / 16384; if (t <= 1000000) { x = t; y = y - 61; } t = x + x / 8192; if (t <= 1000000) { x = t; y = y - 122; }
t = x + x / 32768; if (t <= 1000000) { x = t; y = y - 31; } t = x + x / 16384; if (t <= 1000000) { x = t; y = y - 61; }
t = x + x / 65536; if (t <= 1000000) { y = y - 15; } t = x + x / 32768; if (t <= 1000000) { x = t; y = y - 31; }
return y; t = x + x / 65536; if (t <= 1000000) { y = y - 15; }
return y;
}
} }
} }
)"; )";

View File

@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE(does_not_include_creation_time_only_internal_functions)
contract C { contract C {
uint x; uint x;
constructor() { f(); } constructor() { f(); }
function f() internal { for (uint i = 0; i < 10; ++i) x += 3 + i; } function f() internal { unchecked { for (uint i = 0; i < 10; ++i) x += 3 + i; } }
} }
)"; )";
compiler().setOptimiserSettings(solidity::test::CommonOptions::get().optimize); compiler().setOptimiserSettings(solidity::test::CommonOptions::get().optimize);

View File

@ -757,10 +757,12 @@ BOOST_AUTO_TEST_CASE(high_bits_cleaning)
char const* sourceCode = R"( char const* sourceCode = R"(
contract test { contract test {
function run() public returns(uint256 y) { function run() public returns(uint256 y) {
uint32 t = uint32(0xffffffff); unchecked {
uint32 x = t + 10; uint32 t = uint32(0xffffffff);
if (x >= 0xffffffff) return 0; uint32 x = t + 10;
return x; if (x >= 0xffffffff) return 0;
return x;
}
} }
} }
)"; )";
@ -781,9 +783,11 @@ BOOST_AUTO_TEST_CASE(sign_extension)
char const* sourceCode = R"( char const* sourceCode = R"(
contract test { contract test {
function run() public returns(uint256 y) { function run() public returns(uint256 y) {
int64 x = -int32(0xff); unchecked {
if (x >= 0xff) return 0; int64 x = -int32(0xff);
return 0 - uint256(x); if (x >= 0xff) return 0;
return 0 - uint256(x);
}
} }
} }
)"; )";
@ -803,9 +807,11 @@ BOOST_AUTO_TEST_CASE(small_unsigned_types)
char const* sourceCode = R"( char const* sourceCode = R"(
contract test { contract test {
function run() public returns(uint256 y) { function run() public returns(uint256 y) {
uint32 t = uint32(0xffffff); unchecked {
uint32 x = t * 0xffffff; uint32 t = uint32(0xffffff);
return x / 0x100; uint32 x = t * 0xffffff;
return x / 0x100;
}
} }
} }
)"; )";
@ -1804,8 +1810,11 @@ BOOST_AUTO_TEST_CASE(blockhash)
function g() public returns (bool) { counter++; return true; } function g() public returns (bool) { counter++; return true; }
function f() public returns (bytes32[] memory r) { function f() public returns (bytes32[] memory r) {
r = new bytes32[](259); r = new bytes32[](259);
for (uint i = 0; i < 259; i++) for (uint i = 0; i < 259; i++) {
r[i] = blockhash(block.number - 257 + i); unchecked {
r[i] = blockhash(block.number - 257 + i);
}
}
} }
} }
)"; )";
@ -6881,7 +6890,7 @@ BOOST_AUTO_TEST_CASE(dirty_scratch_space_prior_to_constant_optimiser)
} }
uint x = 0x0000000000001234123412431234123412412342112341234124312341234124; uint x = 0x0000000000001234123412431234123412412342112341234124312341234124;
// This is just to create many instances of x // This is just to create many instances of x
emit X(x + f() * g(tx.origin) ^ h(block.number)); unchecked { emit X(x + f() * g(tx.origin) ^ h(block.number)); }
assembly { assembly {
// make scratch space dirty // make scratch space dirty
mstore(0, 0x4242424242424242424242424242424242424242424242424242424242424242) mstore(0, 0x4242424242424242424242424242424242424242424242424242424242424242)
@ -6892,10 +6901,10 @@ BOOST_AUTO_TEST_CASE(dirty_scratch_space_prior_to_constant_optimiser)
return 0x0000000000001234123412431234123412412342112341234124312341234124; return 0x0000000000001234123412431234123412412342112341234124312341234124;
} }
function g(address a) internal pure returns (uint) { function g(address a) internal pure returns (uint) {
return uint(a) * 0x0000000000001234123412431234123412412342112341234124312341234124; unchecked { return uint(a) * 0x0000000000001234123412431234123412412342112341234124312341234124; }
} }
function h(uint a) internal pure returns (uint) { function h(uint a) internal pure returns (uint) {
return a * 0x0000000000001234123412431234123412412342112341234124312341234124; unchecked { return a * 0x0000000000001234123412431234123412412342112341234124312341234124; }
} }
} }
)"; )";

View File

@ -322,7 +322,7 @@ BOOST_AUTO_TEST_CASE(arithmetic)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(
contract test { contract test {
function f(uint y) { ((((((((y ^ 8) & 7) | 6) - 5) + 4) % 3) / 2) * 1); } function f(uint y) { unchecked { ((((((((y ^ 8) & 7) | 6) - 5) + 4) % 3) / 2) * 1); } }
} }
)"; )";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}}); bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}});
@ -403,7 +403,7 @@ BOOST_AUTO_TEST_CASE(unary_operators)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(
contract test { contract test {
function f(int y) { !(~- y == 2); } function f(int y) { unchecked { !(~- y == 2); } }
} }
)"; )";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}}); bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}});
@ -436,7 +436,7 @@ BOOST_AUTO_TEST_CASE(unary_inc_dec)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(
contract test { contract test {
function f(uint a) public returns (uint x) { x = --a ^ (a-- ^ (++a ^ a++)); } function f(uint a) public returns (uint x) { unchecked { x = --a ^ (a-- ^ (++a ^ a++)); } }
} }
)"; )";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "x"}}); bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "x"}});
@ -493,7 +493,7 @@ BOOST_AUTO_TEST_CASE(assignment)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(
contract test { contract test {
function f(uint a, uint b) { (a += b) * 2; } function f(uint a, uint b) { unchecked { (a += b) * 2; } }
} }
)"; )";
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "b"}}); bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "a"}, {"test", "f", "b"}});

View File

@ -224,8 +224,8 @@ BOOST_AUTO_TEST_CASE(function_calls)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(
contract test { contract test {
function f1(uint x) public returns (uint) { return x*x; } function f1(uint x) public returns (uint) { unchecked { return x*x; } }
function f(uint x) public returns (uint) { return f1(7+x) - this.f1(x**9); } function f(uint x) public returns (uint) { unchecked { return f1(7+x) - this.f1(x**9); } }
} }
)"; )";
compileBothVersions(sourceCode); compileBothVersions(sourceCode);

View File

@ -120,8 +120,9 @@ BOOST_AUTO_TEST_CASE(reserved_keywords)
{ {
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Identifier)); BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Identifier));
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::After)); BOOST_CHECK(TokenTraits::isReservedKeyword(Token::After));
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Unchecked)); BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Unchecked));
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Var)); BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Var));
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Reference));
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Illegal)); BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Illegal));
} }
@ -515,7 +516,6 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved)
"switch", "switch",
"typedef", "typedef",
"typeof", "typeof",
"unchecked",
"var" "var"
}; };

View File

@ -2,16 +2,16 @@ pragma experimental ABIEncoderV2;
contract C { contract C {
function exp_neg_one(uint exponent) public returns(int) { function exp_neg_one(uint exponent) public returns(int) {
return (-1)**exponent; unchecked { return (-1)**exponent; }
} }
function exp_two(uint exponent) public returns(uint) { function exp_two(uint exponent) public returns(uint) {
return 2**exponent; unchecked { return 2**exponent; }
} }
function exp_zero(uint exponent) public returns(uint) { function exp_zero(uint exponent) public returns(uint) {
return 0**exponent; unchecked { return 0**exponent; }
} }
function exp_one(uint exponent) public returns(uint) { function exp_one(uint exponent) public returns(uint) {
return 1**exponent; unchecked { return 1**exponent; }
} }
} }
// ==== // ====

View File

@ -2,16 +2,16 @@ pragma experimental ABIEncoderV2;
contract C { contract C {
function exp_neg_one(uint exponent) public returns(int) { function exp_neg_one(uint exponent) public returns(int) {
return (-1)**exponent; unchecked { return (-1)**exponent; }
} }
function exp_two(uint exponent) public returns(uint) { function exp_two(uint exponent) public returns(uint) {
return 2**exponent; unchecked { return 2**exponent; }
} }
function exp_zero(uint exponent) public returns(uint) { function exp_zero(uint exponent) public returns(uint) {
return 0**exponent; unchecked { return 0**exponent; }
} }
function exp_one(uint exponent) public returns(uint) { function exp_one(uint exponent) public returns(uint) {
return 1**exponent; unchecked { return 1**exponent; }
} }
} }
// ==== // ====

View File

@ -1,7 +1,9 @@
contract C { contract C {
function f() public pure returns (uint x) { function f() public pure returns (uint x) {
uint8 y = uint8(2)**uint8(8); unchecked {
return 0**y; uint8 y = uint8(2)**uint8(8);
return 0**y;
}
} }
} }

View File

@ -1,6 +1,8 @@
contract C { contract C {
function f() public pure returns (uint8 x) { function f() public pure returns (uint8 x) {
return uint8(0)**uint8(uint8(2)**uint8(8)); unchecked {
return uint8(0)**uint8(uint8(2)**uint8(8));
}
} }
} }

View File

@ -1,6 +1,8 @@
contract C { contract C {
function f() public pure returns (uint8 x) { function f() public pure returns (uint8 x) {
return uint8(0x166)**uint8(uint8(2)**uint8(8)); unchecked {
return uint8(0x166)**uint8(uint8(2)**uint8(8));
}
} }
} }

View File

@ -4,7 +4,9 @@ contract C {
// right before the exp // right before the exp
uint16 e = 0x100; uint16 e = 0x100;
uint8 b = 0x2; uint8 b = 0x2;
return b**e; unchecked {
return b**e;
}
} }
} }
// ---- // ----

View File

@ -1,8 +1,10 @@
contract test { contract test {
function f(uint x) public pure returns (uint, int) { function f(uint x) public pure returns (uint, int) {
uint a = 2 ** x; unchecked {
int b = -2 ** x; uint a = 2 ** x;
return (a, b); int b = -2 ** x;
return (a, b);
}
} }
} }
// ---- // ----

View File

@ -1,12 +1,13 @@
contract test { contract test {
function f() public pure returns (uint) { function f() public pure returns (uint r) {
uint32 x; uint32 x;
uint8 y; uint8 y;
assembly { assembly {
x := 0xfffffffffe x := 0xfffffffffe
y := 0x102 y := 0x102
} }
return x**y; unchecked { r = x**y; }
return r;
} }
} }
// ---- // ----

View File

@ -1,6 +1,6 @@
==== Source: s1.sol ==== ==== Source: s1.sol ====
import {f as g, g as h} from "s2.sol"; import {f as g, g as h} from "s2.sol";
function f() pure returns (uint) { return h() - g(); } function f() pure returns (uint) { return 1000 + g() - h(); }
==== Source: s2.sol ==== ==== Source: s2.sol ====
import {f as h} from "s1.sol"; import {f as h} from "s1.sol";
function f() pure returns (uint) { return 2; } function f() pure returns (uint) { return 2; }
@ -10,5 +10,7 @@ contract C {
return h() - f() - g(); return h() - f() - g();
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// foo() -> -4 // foo() -> 992

View File

@ -1,6 +1,6 @@
==== Source: s1.sol ==== ==== Source: s1.sol ====
import {f as g, g as h} from "s2.sol"; import {f as g, g as h} from "s2.sol";
function f() pure returns (uint) { return h() - g(); } function f() pure returns (uint) { return 100 + h() - g(); }
==== Source: s2.sol ==== ==== Source: s2.sol ====
import {f as h} from "s1.sol"; import {f as h} from "s1.sol";
function f() pure returns (uint) { return 2; } function f() pure returns (uint) { return 2; }
@ -12,5 +12,7 @@ contract C {
return f() - g() - h(); return f() - g() - h();
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// foo() -> -4 // foo() -> 0x60

View File

@ -1,6 +1,6 @@
==== Source: s1.sol ==== ==== Source: s1.sol ====
import {f as g, g as h} from "s2.sol"; import {f as g, g as h} from "s2.sol";
function f() pure returns (uint) { return h() - g(); } function f() pure returns (uint) { return 1000 + h() - g(); }
==== Source: s2.sol ==== ==== Source: s2.sol ====
import {f as h} from "s1.sol"; import {f as h} from "s1.sol";
function f() pure returns (uint) { return 2; } function f() pure returns (uint) { return 2; }
@ -9,8 +9,10 @@ function g() pure returns (uint) { return 4; }
import "s2.sol"; import "s2.sol";
contract C { contract C {
function foo() public pure returns (uint) { function foo() public pure returns (uint) {
return f() - g() - h(); return 10000 + f() - g() - h();
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// foo() -> -4 // foo() -> 0x2324

View File

@ -1,11 +1,15 @@
contract C { contract C {
function f() public returns (uint16 x) { function f() public returns (uint16 x) {
x = 0xffff; unchecked {
x += 32; x = 0xffff;
x <<= 8; x += 32;
x >>= 16; x <<= 8;
x >>= 16;
}
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// f() -> 0x0 // f() -> 0x0

View File

@ -13,7 +13,7 @@ contract C {
return (2, 3); return (2, 3);
} }
function h(uint x, uint y) public pure returns (uint) { function h(uint x, uint y) public pure returns (uint) {
return x - y; unchecked { return x - y; }
} }
function i(bool b) public pure returns (bool) { function i(bool b) public pure returns (bool) {
return !b; return !b;
@ -28,6 +28,8 @@ contract C {
return a * 7; return a * 7;
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// d() -> // d() ->
// e(), 1 wei -> 1 // e(), 1 wei -> 1

View File

@ -4,10 +4,10 @@ contract C {
uint16 b; uint16 b;
function f() public returns (uint256, uint256, uint256, uint256) { function f() public returns (uint256, uint256, uint256, uint256) {
a++; unchecked { a++; }
uint256 c = b; uint256 c = b;
delete b; delete b;
a -= 2; unchecked { a -= 2; }
return (x, c, b, a); return (x, c, b, a);
} }
} }

View File

@ -9,8 +9,10 @@ contract C {
returns (uint256 x1, uint256 x2, uint256 x3, uint256 x4) returns (uint256 x1, uint256 x2, uint256 x3, uint256 x4)
{ {
a = -2; a = -2;
b = (0 - uint8(a)) * 2; unchecked {
c = a * int8(120) * int8(121); b = (0 - uint8(a)) * 2;
c = a * int8(120) * int8(121);
}
x1 = uint256(a); x1 = uint256(a);
x2 = b; x2 = b;
x3 = uint256(c); x3 = uint256(c);
@ -18,5 +20,7 @@ contract C {
} }
} }
// ====
// compileViaYul: also
// ---- // ----
// test() -> -2, 4, -112, 0 // test() -> -2, 4, -112, 0

View File

@ -1,7 +1,7 @@
contract test { contract test {
function f() public returns (bool) { function f() public returns (bool) {
int256 x = -2**255; int256 x = -2**255;
assert(-x == x); unchecked { assert(-x == x); }
return true; return true;
} }
} }

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(uint256,uint256): 5, 6 -> 11 // f(uint256,uint256): 5, 6 -> 11
// f(uint256,uint256): -2, 1 -> -1 // f(uint256,uint256): -2, 1 -> -1

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(int256,int256): 5, 6 -> 11 // f(int256,int256): 5, 6 -> 11
// f(int256,int256): -2, 1 -> -1 // f(int256,int256): -2, 1 -> -1

View File

@ -10,7 +10,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(uint256,uint256): 10, 3 -> 3 // f(uint256,uint256): 10, 3 -> 3
// f(uint256,uint256): 1, 0 -> FAILURE // f(uint256,uint256): 1, 0 -> FAILURE

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(uint256,uint256): 10, 3 -> 1 // f(uint256,uint256): 10, 3 -> 1
// f(uint256,uint256): 10, 2 -> 0 // f(uint256,uint256): 10, 2 -> 0

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(int256,int256): 10, 3 -> 1 // f(int256,int256): 10, 3 -> 1
// f(int256,int256): 10, 2 -> 0 // f(int256,int256): 10, 2 -> 0

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(uint256,uint256): 5, 6 -> 30 // f(uint256,uint256): 5, 6 -> 30
// f(uint256,uint256): -1, 1 -> -1 // f(uint256,uint256): -1, 1 -> -1

View File

@ -7,51 +7,42 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(int256,int256): 5, 6 -> 30 // f(int256,int256): 5, 6 -> 30
// f(int256,int256): -1, 1 -> -1 // f(int256,int256): -1, 1 -> -1
// f(int256,int256): -1, 2 -> -2 // f(int256,int256): -1, 2 -> -2 # positive, positive #
// # positive, positive #
// f(int256,int256): 0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, 2 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE // f(int256,int256): 0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, 2 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
// f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000000, 2 -> FAILURE // f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000000, 2 -> FAILURE
// f(int256,int256): 2, 0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE // f(int256,int256): 2, 0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
// f(int256,int256): 2, 0x4000000000000000000000000000000000000000000000000000000000000000 -> FAILURE // f(int256,int256): 2, 0x4000000000000000000000000000000000000000000000000000000000000000 -> FAILURE # positive, negative #
// # positive, negative #
// f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000000, -2 -> 0x8000000000000000000000000000000000000000000000000000000000000000 // f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000000, -2 -> 0x8000000000000000000000000000000000000000000000000000000000000000
// f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000001, -2 -> FAILURE // f(int256,int256): 0x4000000000000000000000000000000000000000000000000000000000000001, -2 -> FAILURE
// f(int256,int256): 2, 0xC000000000000000000000000000000000000000000000000000000000000000 -> 0x8000000000000000000000000000000000000000000000000000000000000000 // f(int256,int256): 2, 0xC000000000000000000000000000000000000000000000000000000000000000 -> 0x8000000000000000000000000000000000000000000000000000000000000000
// f(int256,int256): 2, 0xBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> FAILURE // f(int256,int256): 2, 0xBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> FAILURE # negative, positive #
// # negative, positive #
// f(int256,int256): -2, 0x4000000000000000000000000000000000000000000000000000000000000000 -> 0x8000000000000000000000000000000000000000000000000000000000000000 // f(int256,int256): -2, 0x4000000000000000000000000000000000000000000000000000000000000000 -> 0x8000000000000000000000000000000000000000000000000000000000000000
// f(int256,int256): -2, 0x4000000000000000000000000000000000000000000000000000000000000001 -> FAILURE // f(int256,int256): -2, 0x4000000000000000000000000000000000000000000000000000000000000001 -> FAILURE
// f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000000, 2 -> 0x8000000000000000000000000000000000000000000000000000000000000000 // f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000000, 2 -> 0x8000000000000000000000000000000000000000000000000000000000000000
// f(int256,int256): 0xBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, 2 -> FAILURE // f(int256,int256): 0xBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF, 2 -> FAILURE # negative, negative #
// # negative, negative #
// f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000001, -2 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE // f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000001, -2 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
// f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000000, -2 -> FAILURE // f(int256,int256): 0xC000000000000000000000000000000000000000000000000000000000000000, -2 -> FAILURE
// f(int256,int256): -2, 0xC000000000000000000000000000000000000000000000000000000000000001 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE // f(int256,int256): -2, 0xC000000000000000000000000000000000000000000000000000000000000001 -> 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
// f(int256,int256): -2, 0xC000000000000000000000000000000000000000000000000000000000000000 -> FAILURE // f(int256,int256): -2, 0xC000000000000000000000000000000000000000000000000000000000000000 -> FAILURE # small type #
// # small type #
// g(int8,int8): 5, 6 -> 30 // g(int8,int8): 5, 6 -> 30
// g(int8,int8): -1, 1 -> -1 // g(int8,int8): -1, 1 -> -1
// g(int8,int8): -1, 2 -> -2 // g(int8,int8): -1, 2 -> -2 # positive, positive #
// # positive, positive #
// g(int8,int8): 63, 2 -> 126 // g(int8,int8): 63, 2 -> 126
// g(int8,int8): 64, 2 -> FAILURE // g(int8,int8): 64, 2 -> FAILURE
// g(int8,int8): 2, 63 -> 126 // g(int8,int8): 2, 63 -> 126
// g(int8,int8): 2, 64 -> FAILURE // g(int8,int8): 2, 64 -> FAILURE # positive, negative #
// # positive, negative #
// g(int8,int8): 64, -2 -> -128 // g(int8,int8): 64, -2 -> -128
// g(int8,int8): 65, -2 -> FAILURE // g(int8,int8): 65, -2 -> FAILURE
// g(int8,int8): 2, -64 -> -128 // g(int8,int8): 2, -64 -> -128
// g(int8,int8): 2, -65 -> FAILURE // g(int8,int8): 2, -65 -> FAILURE # negative, positive #
// # negative, positive #
// g(int8,int8): -2, 64 -> -128 // g(int8,int8): -2, 64 -> -128
// g(int8,int8): -2, 65 -> FAILURE // g(int8,int8): -2, 65 -> FAILURE
// g(int8,int8): -64, 2 -> -128 // g(int8,int8): -64, 2 -> -128
// g(int8,int8): -65, 2 -> FAILURE // g(int8,int8): -65, 2 -> FAILURE # negative, negative #
// # negative, negative #
// g(int8,int8): -63, -2 -> 126 // g(int8,int8): -63, -2 -> 126
// g(int8,int8): -64, -2 -> FAILURE // g(int8,int8): -64, -2 -> FAILURE
// g(int8,int8): -2, -63 -> 126 // g(int8,int8): -2, -63 -> 126

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(uint256,uint256): 6, 5 -> 1 // f(uint256,uint256): 6, 5 -> 1
// f(uint256,uint256): 6, 6 -> 0 // f(uint256,uint256): 6, 6 -> 0

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(int256,int256): 5, 6 -> -1 // f(int256,int256): 5, 6 -> -1
// f(int256,int256): -2, 1 -> -3 // f(int256,int256): -2, 1 -> -3

View File

@ -101,4 +101,4 @@ contract ERC20 {
// decreaseAllowance(address,uint256): 2, 0 -> true // decreaseAllowance(address,uint256): 2, 0 -> true
// decreaseAllowance(address,uint256): 2, 1 -> FAILURE // decreaseAllowance(address,uint256): 2, 1 -> FAILURE
// transfer(address,uint256): 2, 14 -> true // transfer(address,uint256): 2, 14 -> true
// transfer(address,uint256): 2, 2 -> FAILURE // transfer(address,uint256): 2, 2 -> FAILURE

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(int8,uint256): 2, 6 -> 64 // f(int8,uint256): 2, 6 -> 64
// f(int8,uint256): 2, 7 -> FAILURE // f(int8,uint256): 2, 7 -> FAILURE

View File

@ -7,7 +7,7 @@ contract C {
} }
} }
// ==== // ====
// compileViaYul: true // compileViaYul: also
// ---- // ----
// f(uint8,uint8): 2, 7 -> 0x80 // f(uint8,uint8): 2, 7 -> 0x80
// f(uint8,uint8): 2, 8 -> FAILURE // f(uint8,uint8): 2, 8 -> FAILURE