Merge pull request #9449 from ethereum/fixEnforceViaYul

Fix enforce via yul
This commit is contained in:
chriseth 2020-07-20 17:01:42 +02:00 committed by GitHub
commit ac95e98b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 65 additions and 4 deletions

View File

@ -46,7 +46,7 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer
m_lineOffset(m_reader.lineNumber()),
m_enforceViaYul(enforceViaYul)
{
string choice = m_reader.stringSetting("compileViaYul", "false");
string choice = m_reader.stringSetting("compileViaYul", "default");
if (choice == "also")
{
m_runWithYul = true;
@ -64,6 +64,11 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer
// Do not try to run via yul if explicitly denied.
m_enforceViaYul = false;
}
else if (choice == "default")
{
m_runWithYul = false;
m_runWithoutYul = true;
}
else
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileViaYul value: " + choice + "."));

View File

@ -18,5 +18,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb

View File

@ -12,5 +12,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f(bytes): 0x20, 0xe0, 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc -> 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc

View File

@ -45,6 +45,8 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f0() -> 0x20, 0x0
// f1() -> 0x20, 0x40, 0x1, 0x2

View File

@ -19,5 +19,7 @@ contract C {
return (b.b, this.g(b));
}
}
// ====
// compileViaYul: also
// ----
// f() -> 11, 11

View File

@ -20,5 +20,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f((uint256,uint256)[]): 0x20, 0x2, 0x1, 0x2, 0x3, 0x4 -> 2, 1, 2, 3, 4

View File

@ -33,6 +33,8 @@ contract c {
l2 = ids.length;
}
}
// ====
// compileViaYul: also
// ----
// setIDStatic(uint256): 0xb ->
// getID(uint256): 0x2 -> 0xb

View File

@ -7,6 +7,7 @@ contract CalldataTest {
}
}
// ====
// compileViaYul: also
// EVMVersion: >=byzantium
// ----
// tester(bytes): 0x20, 0x08, "abcdefgh" -> "c"

View File

@ -16,6 +16,8 @@ contract C {
}
}
}
// ====
// compileViaYul: also
// ----
// f((uint8,bytes1)): 0x12, hex"3400000000000000000000000000000000000000000000000000000000000000" -> 0x12, hex"3400000000000000000000000000000000000000000000000000000000000000" # double check that the valid case goes through #
// f((uint8,bytes1)): 0x1234, hex"5678000000000000000000000000000000000000000000000000000000000000" -> FAILURE

View File

@ -13,5 +13,7 @@ contract C {
return f(s);
}
}
// ====
// compileViaYul: also
// ----
// f(uint256,(uint256,uint256),uint256): 7, 1, 2, 4 -> 1, 2

View File

@ -8,5 +8,7 @@ contract C {
correct = r == (0x64 << 248);
}
}
// ====
// compileViaYul: also
// ----
// f(bytes): 0x20, 0x04, "dead" -> true
// f(bytes): 0x20, 0x04, "dead" -> true

View File

@ -8,5 +8,7 @@ contract C {
correct = r == 0x7fff;
}
}
// ====
// compileViaYul: also
// ----
// f(int16[]): 0x20, 0x02, 0x7fff, 0x7fff -> true
// f(int16[]): 0x20, 0x02, 0x7fff, 0x7fff -> true

View File

@ -9,6 +9,8 @@ contract C {
}
receive() external payable {}
}
// ====
// compileViaYul: also
// ----
// (), 1 ether
// call() -> 1, 2, 2, 2

View File

@ -22,5 +22,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 2

View File

@ -22,5 +22,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 2

View File

@ -7,6 +7,8 @@ import "A";
contract B is A {
function f(uint256 x) public view returns(uint256) { return x; }
}
// ====
// compileViaYul: also
// ----
// f(uint256): 1337 -> 1337
// g(uint256): 1337 -> 1338

View File

@ -17,6 +17,8 @@ contract C {
return T(23, 42, "any");
}
}
// ====
// compileViaYul: also
// ----
// s() -> 23, 42
// t() -> 0x20, 23, 42, 0x60, 3, "any"

View File

@ -41,5 +41,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// test() -> true

View File

@ -29,5 +29,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// test() -> 1

View File

@ -26,5 +26,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// test() -> 1

View File

@ -15,6 +15,8 @@ contract C {
return "\u0024\u00A2\u20AC";
}
}
// ====
// compileViaYul: also
// ----
// oneByteUTF8() -> 0x20, 7, "aaa$aaa"
// twoBytesUTF8() -> 0x20, 8, "aaa\xc2\xa2aaa"

View File

@ -3,5 +3,7 @@ contract C {
return "😃, 😭, and 😈";
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x20, 0x14, "\xf0\x9f\x98\x83, \xf0\x9f\x98\xad, and \xf0\x9f\x98\x88"

View File

@ -13,5 +13,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f((uint256,uint256)): 42, 23 -> 42, 23

View File

@ -16,5 +16,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f(uint256,(uint256,uint256),uint256): 1, 2, 3, 4 -> 1, 2, 3, 4

View File

@ -23,5 +23,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f((uint256,uint256),(uint256),(uint256,uint256)): 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5

View File

@ -7,5 +7,7 @@ contract C {
return (s.children.length, s.a, s.children[0].b, s.children[1].b);
}
}
// ====
// compileViaYul: also
// ----
// f((uint256,(uint256)[])): 32, 17, 64, 2, 23, 42 -> 2, 17, 23, 42

View File

@ -6,5 +6,7 @@ contract C {
return (s.a.length, s.a[0], s.a[1]);
}
}
// ====
// compileViaYul: also
// ----
// f((uint256[])): 32, 32, 2, 42, 23 -> 2, 42, 23

View File

@ -13,5 +13,7 @@ contract Test {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 3

View File

@ -6,5 +6,7 @@ contract C {
}
}
// ====
// compileViaYul: also
// ----
// f() -> 0x20, 5, "b23a5"

View File

@ -58,6 +58,7 @@ contract C {
)
{}
}
// ====
// compileViaYul: false
// ----
// constructor() ->