diff --git a/Changelog.md b/Changelog.md index cd79af81f..cf28403c0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -31,6 +31,7 @@ AST Changes: ### 0.7.6 (unreleased) Language Features: + * Code generator: Support copying dynamically encoded structs from calldata to memory. * The fallback function can now also have a single ``calldata`` argument (equaling ``msg.data``) and return ``bytes memory`` (which will not be ABI-encoded but returned as-is). Compiler Features: @@ -38,6 +39,8 @@ Compiler Features: * SMTChecker: Support named arguments in function calls. * SMTChecker: Support struct constructor. +Bugfixes: + * SMTChecker: Fix internal compiler error when doing bitwise compound assignment with string literals. ### 0.7.5 (2020-11-18) diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 07cb3b4ca..ca6441d0e 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -1106,11 +1106,22 @@ void CompilerUtils::convertType( } case DataLocation::CallData: { - solUnimplementedAssert(!typeOnStack.isDynamicallyEncoded(), ""); - m_context << Instruction::DUP1; - m_context << Instruction::CALLDATASIZE; - m_context << Instruction::SUB; - abiDecode({&targetType}, false); + if (typeOnStack.isDynamicallyEncoded()) + { + solAssert(m_context.useABICoderV2(), ""); + m_context.callYulFunction( + m_context.utilFunctions().conversionFunction(typeOnStack, targetType), + 1, + 1 + ); + } + else + { + m_context << Instruction::DUP1; + m_context << Instruction::CALLDATASIZE; + m_context << Instruction::SUB; + abiDecode({&targetType}, false); + } break; } case DataLocation::Memory: diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index d05bf0aec..6cd5f3c30 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -433,7 +433,7 @@ bool IRGeneratorForStatements::visit(Assignment const& _assignment) { solAssert(type(_assignment) == leftIntermediate.type(), ""); solAssert(type(_assignment) == type(_assignment.leftHandSide()), ""); - define(_assignment) << shiftOperation(binaryOperator, leftIntermediate, value); + define(_assignment) << shiftOperation(binaryOperator, leftIntermediate, value) << "\n"; writeToLValue(*m_currentLValue, IRVariable(_assignment)); m_currentLValue.reset(); @@ -1010,7 +1010,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) m_utils.packedHashFunction({arg.annotation().type}, {referenceType}) << "(" << IRVariable(arg).commaSeparatedList() << - ")"; + ")\n"; else if (auto functionType = dynamic_cast(paramTypes[i])) { solAssert( @@ -1403,6 +1403,8 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) let := iszero(iszero(
)) + + if iszero(
) { () } () )"); @@ -1425,6 +1427,8 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall) t("isTryCall", _functionCall.annotation().tryCall); if (_functionCall.annotation().tryCall) t("success", IRNames::trySuccessConditionVariable(_functionCall)); + else + t("forwardingRevert", m_utils.forwardingRevertFunction()); m_code << t.render(); break; @@ -1581,7 +1585,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) auto contract = dynamic_cast(functionDefinition.scope()); solAssert(contract && contract->isLibrary(), ""); define(IRVariable(_memberAccess).part("address")) << linkerSymbol(*contract) << "\n"; - define(IRVariable(_memberAccess).part("functionSelector")) << memberFunctionType->externalIdentifier(); + define(IRVariable(_memberAccess).part("functionSelector")) << memberFunctionType->externalIdentifier() << "\n"; } return; } @@ -1789,15 +1793,13 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess) baseRef << ", " << offset << - ")" << - std::endl; + ")\n"; else define(_memberAccess) << m_utils.readFromCalldata(*_memberAccess.annotation().type) << "(" << offset << - ")" << - std::endl; + ")\n"; break; } default: @@ -2064,7 +2066,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess) IRVariable(_indexAccess.baseExpression()).commaSeparatedList() + ", " + expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) + - ")\n"; + ")"; if (arrayType.isByteArray()) define(_indexAccess) << m_utils.cleanupFunction(*arrayType.baseType()) << @@ -2078,7 +2080,7 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess) indexAccessFunctionCall << ")\n"; else - define(_indexAccess) << indexAccessFunctionCall; + define(_indexAccess) << indexAccessFunctionCall << "\n"; break; } } diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index bffe372fe..ae5c92845 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -1922,18 +1922,24 @@ smtutil::Expression SMTEncoder::compoundAssignment(Assignment const& _assignment auto decl = identifierToVariable(_assignment.leftHandSide()); + TypePointer commonType = Type::commonType( + _assignment.leftHandSide().annotation().type, + _assignment.rightHandSide().annotation().type + ); + solAssert(commonType == _assignment.annotation().type, ""); + if (compoundToBitwise.count(op)) return bitwiseOperation( compoundToBitwise.at(op), - decl ? currentValue(*decl) : expr(_assignment.leftHandSide()), - expr(_assignment.rightHandSide()), + decl ? currentValue(*decl) : expr(_assignment.leftHandSide(), _assignment.annotation().type), + expr(_assignment.rightHandSide(), _assignment.annotation().type), _assignment.annotation().type ); auto values = arithmeticOperation( compoundToArithmetic.at(op), - decl ? currentValue(*decl) : expr(_assignment.leftHandSide()), - expr(_assignment.rightHandSide()), + decl ? currentValue(*decl) : expr(_assignment.leftHandSide(), _assignment.annotation().type), + expr(_assignment.rightHandSide(), _assignment.annotation().type), _assignment.annotation().type, _assignment ); diff --git a/test/cmdlineTests/ir_compiler_subobjects/output b/test/cmdlineTests/ir_compiler_subobjects/output index 98351c41f..f48b88c6b 100644 --- a/test/cmdlineTests/ir_compiler_subobjects/output +++ b/test/cmdlineTests/ir_compiler_subobjects/output @@ -59,7 +59,11 @@ object "D_15" { let _3 := add(128, _2) if or(gt(_3, 0xffffffffffffffff), lt(_3, 128)) { panic_error_0x41() } datacopy(128, dataoffset("C_2"), _2) - pop(create(_1, 128, _2)) + if iszero(create(_1, 128, _2)) + { + returndatacopy(_1, _1, returndatasize()) + revert(_1, returndatasize()) + } return(allocateMemory(_1), _1) } } diff --git a/test/cmdlineTests/standard_viair_requested/output.json b/test/cmdlineTests/standard_viair_requested/output.json index 5b7f60ec5..7b22c635d 100644 --- a/test/cmdlineTests/standard_viair_requested/output.json +++ b/test/cmdlineTests/standard_viair_requested/output.json @@ -130,6 +130,8 @@ object \"D_15\" { let expr_11_address := create(0, _1, sub(_2, _1)) + if iszero(expr_11_address) { revert_forward_1() } + releaseTemporaryMemory() let vloc_c_7_address := expr_11_address @@ -144,6 +146,11 @@ object \"D_15\" { function releaseTemporaryMemory() { } + function revert_forward_1() { + returndatacopy(0, 0, returndatasize()) + revert(0, returndatasize()) + } + function shift_right_224_unsigned(value) -> newValue { newValue := diff --git a/test/cmdlineTests/viair_subobjects/output b/test/cmdlineTests/viair_subobjects/output index 402807ad1..b25f63a71 100644 --- a/test/cmdlineTests/viair_subobjects/output +++ b/test/cmdlineTests/viair_subobjects/output @@ -35,7 +35,7 @@ object "C_2" { ======= viair_subobjects/input.sol:D ======= Binary: -608060405234156100105760006000fd5b60f980610020600039806000f350fe608060405260043610151561007b576000803560e01c6326121ff0141561007957341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100b7565b5b50806100d160803980608083f050508061007782610085565bf35b505b60006000fd6100cf565b6000604051905081810181811067ffffffffffffffff821117156100ac576100ab6100b7565b5b80604052505b919050565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd +608060405234156100105760006000fd5b61010680610021600039806000f350fe6080604052600436101515610088576000803560e01c6326121ff0141561008657341561002a578081fd5b806003193601121561003a578081fd5b6028806080016080811067ffffffffffffffff8211171561005e5761005d6100c4565b5b50806100de60803980608083f01515610079573d82833e3d82fd5b508061008482610092565bf35b505b60006000fd6100dc565b6000604051905081810181811067ffffffffffffffff821117156100b9576100b86100c4565b5b80604052505b919050565b634e487b7160e01b600052604160045260246000fd5b565bfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd Binary of the runtime part: Optimized IR: @@ -71,7 +71,11 @@ object "D_15" { let _3 := add(128, _2) if or(gt(_3, 0xffffffffffffffff), lt(_3, 128)) { panic_error_0x41() } datacopy(128, dataoffset("C_2"), _2) - pop(create(_1, 128, _2)) + if iszero(create(_1, 128, _2)) + { + returndatacopy(_1, _1, returndatasize()) + revert(_1, returndatasize()) + } return(allocateMemory(_1), _1) } } diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol b/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol index 1be4c3931..2118a854d 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol @@ -39,7 +39,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // f() -> 0 // g() -> 0 diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_memory.sol b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_memory.sol index 6759b7e81..dbafccf9c 100644 --- a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_memory.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; contract c { function test1(uint256[][] calldata c) external returns (uint256, uint256) { diff --git a/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_memory.sol b/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_memory.sol index e7c39f3f3..82cde13af 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_memory.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; contract C { struct S { diff --git a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_memory.sol b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_memory.sol index e1f2c76e2..13e05c4ee 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_memory.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; contract C { struct S { diff --git a/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol b/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol index 0fff30ae1..5310d097b 100644 --- a/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol +++ b/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol @@ -16,7 +16,6 @@ contract B { // ==== // compileViaYul: also -// compileToEwasm: also // ---- // testIt() -> // test() -> 2 diff --git a/test/libsolidity/semanticTests/constructor_ihneritance_init_order_2.sol b/test/libsolidity/semanticTests/constructor_ihneritance_init_order_2.sol index 487dad3ec..de3529f77 100644 --- a/test/libsolidity/semanticTests/constructor_ihneritance_init_order_2.sol +++ b/test/libsolidity/semanticTests/constructor_ihneritance_init_order_2.sol @@ -8,7 +8,7 @@ contract B is A { uint public y = f(); } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // constructor() -> diff --git a/test/libsolidity/semanticTests/freeFunctions/free_runtimecode.sol b/test/libsolidity/semanticTests/freeFunctions/free_runtimecode.sol index a79d68a3c..5c2e2f909 100644 --- a/test/libsolidity/semanticTests/freeFunctions/free_runtimecode.sol +++ b/test/libsolidity/semanticTests/freeFunctions/free_runtimecode.sol @@ -12,6 +12,6 @@ contract D { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/freeFunctions/new_operator.sol b/test/libsolidity/semanticTests/freeFunctions/new_operator.sol index 7a7e53759..d0eea9f96 100644 --- a/test/libsolidity/semanticTests/freeFunctions/new_operator.sol +++ b/test/libsolidity/semanticTests/freeFunctions/new_operator.sol @@ -12,6 +12,6 @@ contract D { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/getters/small_types.sol b/test/libsolidity/semanticTests/getters/small_types.sol deleted file mode 100644 index 7b82bcc40..000000000 --- a/test/libsolidity/semanticTests/getters/small_types.sol +++ /dev/null @@ -1,20 +0,0 @@ -contract C { - uint8 public a; - uint16 public b; - uint128 public c; - uint public d; - constructor() { - a = 3; - b = 4; - c = 5; - d = 6; - } -} -// ==== -// compileViaYul: also -// compileToEwasm: also -// ---- -// a() -> 3 -// b() -> 4 -// c() -> 5 -// d() -> 6 diff --git a/test/libsolidity/semanticTests/getters/string_and_bytes.sol b/test/libsolidity/semanticTests/getters/string_and_bytes.sol new file mode 100644 index 000000000..731d5678c --- /dev/null +++ b/test/libsolidity/semanticTests/getters/string_and_bytes.sol @@ -0,0 +1,14 @@ +contract C { + string public a; + string public b; + bytes public c; + constructor() { + a = "hello world"; + b = hex"41424344"; + c = hex"ff077fff"; + } +} +// ---- +// a() -> 0x20, 11, "hello world" +// b() -> 0x20, 4, "ABCD" +// c() -> 0x20, 4, -439061522557375173052089223601630338202760422010735733633791622124826263552 diff --git a/test/libsolidity/semanticTests/getters/value_types.sol b/test/libsolidity/semanticTests/getters/value_types.sol new file mode 100644 index 000000000..38a95dd36 --- /dev/null +++ b/test/libsolidity/semanticTests/getters/value_types.sol @@ -0,0 +1,35 @@ +contract C { + uint8 public a; + uint16 public b; + uint128 public c; + uint public d; + bytes1 public e; + bytes20 public f; + bytes32 public g; + bool public h; + address public i; + constructor() { + a = 3; + b = 4; + c = 5; + d = 6; + e = bytes1(uint8(0x7f)); + f = bytes20(uint160(0x64656164626565663135646561640000000000000010)); + g = bytes32(uint256(0x6465616462656566313564656164000000000000000000000000000000000010)); + h = true; + i = address(type(uint160).max / 3); + } +} +// ==== +// compileToEwasm: also +// compileViaYul: also +// ---- +// a() -> 3 +// b() -> 4 +// c() -> 5 +// d() -> 6 +// e() -> 0x7f00000000000000000000000000000000000000000000000000000000000000 +// f() -> 0x6164626565663135646561640000000000000010000000000000000000000000 +// g() -> 0x6465616462656566313564656164000000000000000000000000000000000010 +// h() -> true +// i() -> 0x5555555555555555555555555555555555555555 diff --git a/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1.sol b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1.sol new file mode 100644 index 000000000..e10cb267c --- /dev/null +++ b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1.sol @@ -0,0 +1,10 @@ +pragma abicoder v1; +contract C { + function t(uint) public pure {} +} +// ==== +// EVMVersion: >=byzantium +// compileViaYul: false +// revertStrings: debug +// ---- +// t(uint256) -> FAILURE, hex"08c379a0", 0x20, 0x12, "Calldata too short" diff --git a/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1_abiv2.sol b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1_abiv2.sol new file mode 100644 index 000000000..dc7c169b9 --- /dev/null +++ b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v1_abiv2.sol @@ -0,0 +1,10 @@ +pragma abicoder v2; +contract C { + function t(uint) public pure {} +} +// ==== +// EVMVersion: >=byzantium +// compileViaYul: false +// revertStrings: debug +// ---- +// t(uint256) -> FAILURE, hex"08c379a0", 0x20, 34, "ABI decoding: tuple data too sho", "rt" diff --git a/test/libsolidity/semanticTests/revertStrings/function_entry_checks.sol b/test/libsolidity/semanticTests/revertStrings/function_entry_checks_v2.sol similarity index 100% rename from test/libsolidity/semanticTests/revertStrings/function_entry_checks.sol rename to test/libsolidity/semanticTests/revertStrings/function_entry_checks_v2.sol diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_nested_structs.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_nested_structs.sol index ee9527236..72e65b9ef 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_nested_structs.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_nested_structs.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; contract C { struct S { @@ -42,7 +42,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // f((uint128, (uint128, uint256[][2], uint32)), uint32): 0x40, 44, 11, 0x40, 22, 0x60, 33, 0x40, 0x40, 2, 1, 2 -> 44, 22, 1, 2, 33 // g(((uint128, uint256[][2], uint32)[2])): 0x20, 0x20, 0x40, 0x40, 22, 0x60, 33, 0x40, 0x40, 2, 1, 2 -> 22, 1, 2, 33 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_as_argument_of_lib_function.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_as_argument_of_lib_function.sol index c44c5cd2a..ea405da90 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_as_argument_of_lib_function.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_as_argument_of_lib_function.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; struct S { uint128 p1; @@ -23,7 +23,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // library: L // f((uint128, (uint128, uint256[][2], uint32)), uint32): 0x40, 44, 11, 0x40, 22, 0x60, 33, 0x40, 0x40, 2, 1, 2 -> 44, 22, 1, 2, 33 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_as_memory_argument.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_as_memory_argument.sol index 71b55abf4..ae7bea152 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_as_memory_argument.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_as_memory_argument.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; contract C { struct S { @@ -18,6 +18,6 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // f(uint32, (uint128, uint256[][2], uint32)): 55, 0x40, 77, 0x60, 88, 0x40, 0x40, 2, 1, 2 -> 55, 78, 1, 2, 88 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory_tuple_assignment.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory_tuple_assignment.sol index 9bf1d1f48..9d928fb6a 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory_tuple_assignment.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory_tuple_assignment.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; contract C { struct S { @@ -17,6 +17,6 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // f(uint32, (uint128, uint256[][2], uint32)): 55, 0x40, 77, 0x60, 88, 0x40, 0x40, 2, 1, 2 -> 55, 78, 1, 2, 88 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol index 5f6aaa07d..25530a181 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; contract C { struct S { diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol new file mode 100644 index 000000000..fba9a8e72 --- /dev/null +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol @@ -0,0 +1,23 @@ +pragma abicoder v2; + +contract C { + struct S { + uint256 a; + bytes b; + uint256 c; + } + + function f(S calldata c) + external + pure + returns (uint256, byte, byte, uint256) + { + S memory m = c; + return (m.a, m.b[0], m.b[1], m.c); + } +} + +// ==== +// compileViaYul: also +// ---- +// f((uint256,bytes,uint256)): 0x20, 42, 0x60, 23, 2, "ab" -> 42, "a", "b", 23 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_nested_array_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_nested_array_to_memory.sol index 9ad5bed9c..a84c88851 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_nested_array_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_nested_array_to_memory.sol @@ -1,4 +1,4 @@ -pragma experimental ABIEncoderV2; +pragma abicoder v2; contract C { struct S { @@ -18,6 +18,6 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // f(uint32, (uint128, uint256[][2], uint32)): 55, 0x40, 77, 0x60, 88, 0x40, 0x40, 2, 1, 2 -> 55, 78, 1, 2, 88 diff --git a/test/libsolidity/semanticTests/tryCatch/try_catch_library_call.sol b/test/libsolidity/semanticTests/tryCatch/try_catch_library_call.sol index e7bad76b0..cf061a8c9 100644 --- a/test/libsolidity/semanticTests/tryCatch/try_catch_library_call.sol +++ b/test/libsolidity/semanticTests/tryCatch/try_catch_library_call.sol @@ -36,6 +36,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >=byzantium // ---- // library: L diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol index e4e6453c5..9fa78f530 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol @@ -19,5 +19,7 @@ contract Test { new C(); } } +// ==== +// compileViaYul: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol index fbaca1a67..2477ad963 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol @@ -19,5 +19,7 @@ contract Test { new C(); } } +// ==== +// compileViaYul: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/viaYul/array_memory_as_parameter.sol b/test/libsolidity/semanticTests/viaYul/array_memory_as_parameter.sol index 3a19b2238..55e10487e 100644 --- a/test/libsolidity/semanticTests/viaYul/array_memory_as_parameter.sol +++ b/test/libsolidity/semanticTests/viaYul/array_memory_as_parameter.sol @@ -18,7 +18,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // test(uint256,uint256): 0, 0 -> FAILURE, hex"4e487b71", 0x32 // test(uint256,uint256): 1, 0 -> 1 diff --git a/test/libsolidity/semanticTests/viaYul/array_memory_create.sol b/test/libsolidity/semanticTests/viaYul/array_memory_create.sol index 9b2a33442..d1a9c5e2e 100644 --- a/test/libsolidity/semanticTests/viaYul/array_memory_create.sol +++ b/test/libsolidity/semanticTests/viaYul/array_memory_create.sol @@ -6,7 +6,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // create(uint256): 0 -> 0 // create(uint256): 7 -> 7 diff --git a/test/libsolidity/semanticTests/viaYul/array_memory_index_access.sol b/test/libsolidity/semanticTests/viaYul/array_memory_index_access.sol index 2d8566d3d..edea7fc3e 100644 --- a/test/libsolidity/semanticTests/viaYul/array_memory_index_access.sol +++ b/test/libsolidity/semanticTests/viaYul/array_memory_index_access.sol @@ -22,7 +22,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // index(uint256): 0 -> true // index(uint256): 10 -> true diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol index d286fc36c..efc67e517 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol @@ -14,7 +14,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // test_indices(uint256): 1 -> // test_indices(uint256): 129 -> diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol index 529ac67bb..db007858c 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol @@ -10,7 +10,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // test_boundary_check(uint256,uint256): 10, 11 -> FAILURE, hex"4e487b71", 0x32 // test_boundary_check(uint256,uint256): 10, 9 -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol index c0ae21681..e02dc027d 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol @@ -50,7 +50,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // test_zeroed_indicies(uint256): 1 -> // test_zeroed_indicies(uint256): 5 -> diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_length_access.sol b/test/libsolidity/semanticTests/viaYul/array_storage_length_access.sol index 266c5ae3b..95ca92782 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_length_access.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_length_access.sol @@ -7,7 +7,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // set_get_length(uint256): 0 -> 0 // set_get_length(uint256): 1 -> 1 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_pop_zero_length.sol b/test/libsolidity/semanticTests/viaYul/array_storage_pop_zero_length.sol index e5e26ee36..2a09ba31e 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_pop_zero_length.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_pop_zero_length.sol @@ -6,6 +6,6 @@ contract C { } // ==== // EVMVersion: >=petersburg -// compileViaYul: true +// compileViaYul: also // ---- // popEmpty() -> FAILURE, hex"4e487b71", 0x31 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol index e692b273a..432ab243b 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol @@ -9,7 +9,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // EVMVersion: >=petersburg // ---- // pushEmpty(uint256): 128 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol index 7f9bd82dd..e28106443 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol @@ -10,7 +10,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // EVMVersion: >=petersburg // ---- // set_get_length(uint256): 0 -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol index 3dce6216f..e40223908 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol @@ -9,7 +9,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // set_get_length(uint256): 0 -> 0 // set_get_length(uint256): 1 -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/assert.sol b/test/libsolidity/semanticTests/viaYul/assert.sol index bcb4e3435..5b19d3a00 100644 --- a/test/libsolidity/semanticTests/viaYul/assert.sol +++ b/test/libsolidity/semanticTests/viaYul/assert.sol @@ -14,7 +14,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(bool): true -> true diff --git a/test/libsolidity/semanticTests/viaYul/assert_and_require.sol b/test/libsolidity/semanticTests/viaYul/assert_and_require.sol index 29f1678ed..8c435291b 100644 --- a/test/libsolidity/semanticTests/viaYul/assert_and_require.sol +++ b/test/libsolidity/semanticTests/viaYul/assert_and_require.sol @@ -11,7 +11,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(bool): true -> true diff --git a/test/libsolidity/semanticTests/viaYul/comparison.sol b/test/libsolidity/semanticTests/viaYul/comparison.sol index c42ae6df9..aa520f53b 100644 --- a/test/libsolidity/semanticTests/viaYul/comparison.sol +++ b/test/libsolidity/semanticTests/viaYul/comparison.sol @@ -37,7 +37,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // f(address): 0x1234 -> false // f(address): 0x00 -> true diff --git a/test/libsolidity/semanticTests/viaYul/comparison_functions.sol b/test/libsolidity/semanticTests/viaYul/comparison_functions.sol index 3ea94fe09..f0b07ba3b 100644 --- a/test/libsolidity/semanticTests/viaYul/comparison_functions.sol +++ b/test/libsolidity/semanticTests/viaYul/comparison_functions.sol @@ -1,9 +1,11 @@ contract C { + // If these two functions are identical, the optimiser + // on the old codegen path can deduplicate them, and breaking the test. function internal1() internal pure returns (bool) { return true; } function internal2() internal pure returns (bool) { - return true; + return false; } function equal() public pure returns (bool same, bool diff, bool inv) { @@ -23,7 +25,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // equal() -> true, false, false diff --git a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_assignment.sol b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_assignment.sol index 02c9448c7..afa5c531b 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_assignment.sol @@ -5,7 +5,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_function_call.sol b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_function_call.sol index e160db631..67a831de9 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_function_call.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_function_call.sol @@ -7,7 +7,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // g() -> 0x1234567800000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_local_assignment.sol b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_local_assignment.sol index d90f9bbd8..a857d86c0 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_local_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_local_assignment.sol @@ -5,7 +5,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(uint256): 0x12345678 -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_assignment.sol b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_assignment.sol index 08ba9e962..60e553d0b 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_assignment.sol @@ -9,7 +9,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_function_call.sol b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_function_call.sol index a94ad2097..1588adef5 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_function_call.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_function_call.sol @@ -12,7 +12,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // g() -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_local_assignment.sol b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_local_assignment.sol index 49c1e9252..ebae02779 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_local_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_local_assignment.sol @@ -8,7 +8,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/delete.sol b/test/libsolidity/semanticTests/viaYul/delete.sol index 1d2c3dac1..6b23245ea 100644 --- a/test/libsolidity/semanticTests/viaYul/delete.sol +++ b/test/libsolidity/semanticTests/viaYul/delete.sol @@ -19,7 +19,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // call_deleted_internal_func() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol b/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol index 434b21f7d..44466d911 100644 --- a/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol +++ b/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol @@ -17,7 +17,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/if.sol b/test/libsolidity/semanticTests/viaYul/if.sol index 85afad75b..49c9453b8 100644 --- a/test/libsolidity/semanticTests/viaYul/if.sol +++ b/test/libsolidity/semanticTests/viaYul/if.sol @@ -60,7 +60,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(bool): 0 -> 23 diff --git a/test/libsolidity/semanticTests/viaYul/keccak.sol b/test/libsolidity/semanticTests/viaYul/keccak.sol index 58c37ebd6..1befe8f7c 100644 --- a/test/libsolidity/semanticTests/viaYul/keccak.sol +++ b/test/libsolidity/semanticTests/viaYul/keccak.sol @@ -8,7 +8,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // keccak1() -> 0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107 // keccak2() -> 0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107 diff --git a/test/libsolidity/semanticTests/viaYul/local_address_assignment.sol b/test/libsolidity/semanticTests/viaYul/local_address_assignment.sol index 647e81f9e..438108da3 100644 --- a/test/libsolidity/semanticTests/viaYul/local_address_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/local_address_assignment.sol @@ -5,7 +5,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(address): 0x1234 -> 0x1234 diff --git a/test/libsolidity/semanticTests/viaYul/local_assignment.sol b/test/libsolidity/semanticTests/viaYul/local_assignment.sol index 9524b009e..cdb84c3cb 100644 --- a/test/libsolidity/semanticTests/viaYul/local_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/local_assignment.sol @@ -5,7 +5,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(uint256): 6 -> 6 diff --git a/test/libsolidity/semanticTests/viaYul/local_bool_assignment.sol b/test/libsolidity/semanticTests/viaYul/local_bool_assignment.sol index fab0cfd85..4b1371f33 100644 --- a/test/libsolidity/semanticTests/viaYul/local_bool_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/local_bool_assignment.sol @@ -5,7 +5,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(bool): true -> true diff --git a/test/libsolidity/semanticTests/viaYul/loops/break.sol b/test/libsolidity/semanticTests/viaYul/loops/break.sol index 349085be4..2f683c0cf 100644 --- a/test/libsolidity/semanticTests/viaYul/loops/break.sol +++ b/test/libsolidity/semanticTests/viaYul/loops/break.sol @@ -24,7 +24,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/viaYul/loops/continue.sol b/test/libsolidity/semanticTests/viaYul/loops/continue.sol index f63cfd632..14e5ca5f4 100644 --- a/test/libsolidity/semanticTests/viaYul/loops/continue.sol +++ b/test/libsolidity/semanticTests/viaYul/loops/continue.sol @@ -30,7 +30,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 11 diff --git a/test/libsolidity/semanticTests/viaYul/loops/return.sol b/test/libsolidity/semanticTests/viaYul/loops/return.sol index 3a734c83e..b8ced9fe6 100644 --- a/test/libsolidity/semanticTests/viaYul/loops/return.sol +++ b/test/libsolidity/semanticTests/viaYul/loops/return.sol @@ -27,7 +27,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/viaYul/loops/simple.sol b/test/libsolidity/semanticTests/viaYul/loops/simple.sol index 0dbd5e113..b42f79c44 100644 --- a/test/libsolidity/semanticTests/viaYul/loops/simple.sol +++ b/test/libsolidity/semanticTests/viaYul/loops/simple.sol @@ -30,7 +30,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 1024 diff --git a/test/libsolidity/semanticTests/viaYul/mapping_string_key.sol b/test/libsolidity/semanticTests/viaYul/mapping_string_key.sol index 880522d60..299f790ce 100644 --- a/test/libsolidity/semanticTests/viaYul/mapping_string_key.sol +++ b/test/libsolidity/semanticTests/viaYul/mapping_string_key.sol @@ -5,6 +5,6 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // set(string): 0x20, 32, "01234567890123456789012345678901" -> diff --git a/test/libsolidity/semanticTests/viaYul/msg_sender.sol b/test/libsolidity/semanticTests/viaYul/msg_sender.sol index ae5468059..5ce5b530b 100644 --- a/test/libsolidity/semanticTests/viaYul/msg_sender.sol +++ b/test/libsolidity/semanticTests/viaYul/msg_sender.sol @@ -6,7 +6,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // test() -> true diff --git a/test/libsolidity/semanticTests/viaYul/return.sol b/test/libsolidity/semanticTests/viaYul/return.sol index 98d4ff97c..1b5a983c1 100644 --- a/test/libsolidity/semanticTests/viaYul/return.sol +++ b/test/libsolidity/semanticTests/viaYul/return.sol @@ -5,7 +5,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/viaYul/return_and_convert.sol b/test/libsolidity/semanticTests/viaYul/return_and_convert.sol index 85f105575..082dc4048 100644 --- a/test/libsolidity/semanticTests/viaYul/return_and_convert.sol +++ b/test/libsolidity/semanticTests/viaYul/return_and_convert.sol @@ -6,7 +6,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 255 diff --git a/test/libsolidity/semanticTests/viaYul/short_circuit.sol b/test/libsolidity/semanticTests/viaYul/short_circuit.sol index bc7288767..7acb4cbfd 100644 --- a/test/libsolidity/semanticTests/viaYul/short_circuit.sol +++ b/test/libsolidity/semanticTests/viaYul/short_circuit.sol @@ -9,7 +9,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // or(uint256): 0 -> true, 0 diff --git a/test/libsolidity/semanticTests/viaYul/simple_assignment.sol b/test/libsolidity/semanticTests/viaYul/simple_assignment.sol index 67c2de9be..0d54426a9 100644 --- a/test/libsolidity/semanticTests/viaYul/simple_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/simple_assignment.sol @@ -5,7 +5,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(uint256,uint256): 5, 6 -> 5, 6 diff --git a/test/libsolidity/semanticTests/viaYul/simple_inline_asm.sol b/test/libsolidity/semanticTests/viaYul/simple_inline_asm.sol index 57080cef7..a2aec51df 100644 --- a/test/libsolidity/semanticTests/viaYul/simple_inline_asm.sol +++ b/test/libsolidity/semanticTests/viaYul/simple_inline_asm.sol @@ -12,7 +12,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 6 diff --git a/test/libsolidity/semanticTests/viaYul/smoke_test.sol b/test/libsolidity/semanticTests/viaYul/smoke_test.sol index 3c58bbd1c..7acfd831a 100644 --- a/test/libsolidity/semanticTests/viaYul/smoke_test.sol +++ b/test/libsolidity/semanticTests/viaYul/smoke_test.sol @@ -1,7 +1,7 @@ contract C { } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // allowNonExistingFunctions: true // ---- diff --git a/test/libsolidity/semanticTests/viaYul/storage/mappings.sol b/test/libsolidity/semanticTests/viaYul/storage/mappings.sol index 78c080a2a..5666635b5 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/mappings.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/mappings.sol @@ -29,7 +29,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // ---- // test_simple(uint256): 0 -> 3, 4, 5 // test_simple(uint256): 1 -> 3, 4, 5 diff --git a/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol b/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol index 340da2963..15d04fff3 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol @@ -11,7 +11,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f(uint8): 6 -> 9 diff --git a/test/libsolidity/semanticTests/viaYul/storage/simple_storage.sol b/test/libsolidity/semanticTests/viaYul/storage/simple_storage.sol index 32016a624..6c5143534 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/simple_storage.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/simple_storage.sol @@ -11,7 +11,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // setX(uint256): 6 -> 6 diff --git a/test/libsolidity/semanticTests/viaYul/string_format.sol b/test/libsolidity/semanticTests/viaYul/string_format.sol index 8723c2fc7..669de6e9a 100644 --- a/test/libsolidity/semanticTests/viaYul/string_format.sol +++ b/test/libsolidity/semanticTests/viaYul/string_format.sol @@ -5,7 +5,7 @@ contract C { function h() external pure returns (bytes4) { return 0xcafecafe; } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f1() -> 0x20, 6, left(0x616263616263) diff --git a/test/libsolidity/semanticTests/viaYul/string_literals.sol b/test/libsolidity/semanticTests/viaYul/string_literals.sol index 746c5fd30..57682e20a 100644 --- a/test/libsolidity/semanticTests/viaYul/string_literals.sol +++ b/test/libsolidity/semanticTests/viaYul/string_literals.sol @@ -19,7 +19,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // short_dyn() -> 0x20, 3, "abc" diff --git a/test/libsolidity/semanticTests/viaYul/various_inline_asm.sol b/test/libsolidity/semanticTests/viaYul/various_inline_asm.sol index 5ad0e7129..f3bcf56fc 100644 --- a/test/libsolidity/semanticTests/viaYul/various_inline_asm.sol +++ b/test/libsolidity/semanticTests/viaYul/various_inline_asm.sol @@ -18,7 +18,7 @@ contract C { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 70 diff --git a/test/libsolidity/semanticTests/viaYul/virtual_functions.sol b/test/libsolidity/semanticTests/viaYul/virtual_functions.sol index cb86c8933..45d4ccf46 100644 --- a/test/libsolidity/semanticTests/viaYul/virtual_functions.sol +++ b/test/libsolidity/semanticTests/viaYul/virtual_functions.sol @@ -24,7 +24,7 @@ contract C is X { } } // ==== -// compileViaYul: true +// compileViaYul: also // compileToEwasm: also // ---- // f() -> 3 diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal.sol new file mode 100644 index 000000000..b95fe80c4 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal.sol @@ -0,0 +1,17 @@ +pragma experimental SMTChecker; + +contract C { + function f() public pure { + bytes memory y = "def"; + y[0] &= "d"; + assert(y[0] == "d"); + + y[0] |= "e"; + assert(y[0] == "d"); // fails + + y[0] ^= "f"; + assert(y[0] == (byte("d") | byte("e")) ^ byte("f")); + } +} +// ---- +// Warning 6328: (189-208): CHC: Assertion violation happens here. diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal_2.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal_2.sol new file mode 100644 index 000000000..31eaf90d6 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal_2.sol @@ -0,0 +1,17 @@ +pragma experimental SMTChecker; + +contract C { + function f() public pure { + bytes3 y = "def"; + y &= "def"; + assert(y == "def"); + + y |= "dee"; + assert(y == "def"); // fails + + y ^= "fed"; + assert(y == (bytes3("def") | bytes3("dee")) ^ bytes3("fed")); + } +} +// ---- +// Warning 6328: (180-198): CHC: Assertion violation happens here. diff --git a/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal_3.sol b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal_3.sol new file mode 100644 index 000000000..709701bf6 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/operators/compound_bitwise_string_literal_3.sol @@ -0,0 +1,21 @@ +pragma experimental SMTChecker; + +contract C { + function f() public pure { + bytes32 y = "abcdefghabcdefghabcdefghabcdefgh"; + bytes32 z = y; + y &= "bcdefghabcdefghabcdefghabcdefgha"; + z &= "bcdefghabcdefghabcdefghabcdefgha"; + assert(y == "abcdefghabcdefghabcdefghabcdefgh"); // fails + + y |= "cdefghabcdefghabcdefghabcdefghab"; + z |= "cdefghabcdefghabcdefghabcdefghab"; + assert(y == "abcdefghabcdefghabcdefghabcd"); // fails + + y ^= "abcdefghabcdefghabcdefghabcdefgh"; + assert(y == z ^ "abcdefghabcdefghabcdefghabcdefgh"); + } +} +// ---- +// Warning 6328: (262-309): CHC: Assertion violation happens here. +// Warning 6328: (427-470): CHC: Assertion violation happens here.