diff --git a/libsolidity/ast/ASTAnnotations.h b/libsolidity/ast/ASTAnnotations.h index 027b48a30..97077c9a6 100644 --- a/libsolidity/ast/ASTAnnotations.h +++ b/libsolidity/ast/ASTAnnotations.h @@ -94,6 +94,7 @@ struct SourceUnitAnnotation: ASTAnnotation SetOnce>> exportedSymbols; /// Experimental features. std::set experimentalFeatures; + /// Using the new ABI coder. Set to `false` if using ABI coder v1. SetOnce useABICoderV2; }; diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 7a4d37448..90c809e13 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -1249,6 +1249,14 @@ void CompilerStack::generateIR(ContractDefinition const& _contract) if (!compiledContract.yulIR.empty()) return; + if (!*_contract.sourceUnit().annotation().useABICoderV2) + m_errorReporter.warning( + 2066_error, + _contract.location(), + "Contract requests the ABI coder v1, which is incompatible with the IR. " + "Using ABI coder v2 instead." + ); + string dependenciesSource; for (auto const* dependency: _contract.annotation().contractDependencies) generateIR(*dependency); diff --git a/scripts/error_codes.py b/scripts/error_codes.py index 9b106d0c0..bf4079b32 100755 --- a/scripts/error_codes.py +++ b/scripts/error_codes.py @@ -221,7 +221,7 @@ def examine_id_coverage(top_dir, source_id_to_file_names, new_ids_only=False): old_source_only_ids = { "1123", "1220", "1584", "1823", - "1988", "2657", "2800", "3356", + "1988", "2066", "2657", "2800", "3356", "3893", "3996", "4010", "4802", "5073", "5272", "5622", "7128", "7589", "7593", "7653", "8065", "8084", "8140", diff --git a/test/cmdlineTests/exp_base_literal/input.sol b/test/cmdlineTests/exp_base_literal/input.sol index 1f4d4dd7f..1c8408413 100644 --- a/test/cmdlineTests/exp_base_literal/input.sol +++ b/test/cmdlineTests/exp_base_literal/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity > 0.7.1; +pragma abicoder v2; contract C { function f(uint a, uint b, uint c, uint d) public pure returns (uint, int, uint, uint) { diff --git a/test/cmdlineTests/exp_base_literal/output b/test/cmdlineTests/exp_base_literal/output index 89815e804..8f39ff6c5 100644 --- a/test/cmdlineTests/exp_base_literal/output +++ b/test/cmdlineTests/exp_base_literal/output @@ -7,23 +7,23 @@ IR: *******************************************************/ -object "C_80" { +object "C_81" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_80() + constructor_C_81() - codecopy(0, dataoffset("C_80_deployed"), datasize("C_80_deployed")) + codecopy(0, dataoffset("C_81_deployed"), datasize("C_81_deployed")) - return(0, datasize("C_80_deployed")) + return(0, datasize("C_81_deployed")) - function constructor_C_80() { + function constructor_C_81() { } } - object "C_80_deployed" { + object "C_81_deployed" { code { mstore(64, 128) @@ -37,7 +37,7 @@ object "C_80" { // f(uint256,uint256,uint256,uint256) if callvalue() { revert(0, 0) } let param_0, param_1, param_2, param_3 := abi_decode_tuple_t_uint256t_uint256t_uint256t_uint256(4, calldatasize()) - let ret_0, ret_1, ret_2, ret_3 := fun_f_79(param_0, param_1, param_2, param_3) + let ret_0, ret_1, ret_2, ret_3 := fun_f_80(param_0, param_1, param_2, param_3) let memPos := allocateMemory(0) let memEnd := abi_encode_tuple_t_uint256_t_int256_t_uint256_t_uint256__to_t_uint256_t_int256_t_uint256_t_uint256__fromStack(memPos , ret_0, ret_1, ret_2, ret_3) return(memPos, sub(memEnd, memPos)) @@ -201,83 +201,83 @@ object "C_80" { converted := cleanup_t_int256(value) } - function fun_f_79(vloc_a_3, vloc_b_5, vloc_c_7, vloc_d_9) -> vloc__12, vloc__14, vloc__16, vloc__18 { + function fun_f_80(vloc_a_4, vloc_b_6, vloc_c_8, vloc_d_10) -> vloc__13, vloc__15, vloc__17, vloc__19 { let zero_value_for_type_t_uint256_1 := zero_value_for_split_t_uint256() - vloc__12 := zero_value_for_type_t_uint256_1 + vloc__13 := zero_value_for_type_t_uint256_1 let zero_value_for_type_t_int256_2 := zero_value_for_split_t_int256() - vloc__14 := zero_value_for_type_t_int256_2 + vloc__15 := zero_value_for_type_t_int256_2 let zero_value_for_type_t_uint256_3 := zero_value_for_split_t_uint256() - vloc__16 := zero_value_for_type_t_uint256_3 + vloc__17 := zero_value_for_type_t_uint256_3 let zero_value_for_type_t_uint256_4 := zero_value_for_split_t_uint256() - vloc__18 := zero_value_for_type_t_uint256_4 + vloc__19 := zero_value_for_type_t_uint256_4 - let expr_22 := 0x02 - let _5 := vloc_a_3 - let expr_23 := _5 - let _6 := convert_t_rational_2_by_1_to_t_uint256(expr_22) - let expr_24 := checked_exp_t_rational_2_by_1_t_uint256(expr_23) - let vloc_w_21 := expr_24 - let expr_28 := 0x02 - let expr_29 := 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe - let expr_30 := expr_29 - let _7 := vloc_b_5 - let expr_31 := _7 - let _8 := convert_t_rational_minus_2_by_1_to_t_int256(expr_30) - let expr_32 := checked_exp_t_rational_minus_2_by_1_t_uint256(expr_31) - let vloc_x_27 := expr_32 - let expr_36 := 0x0a - let _9 := vloc_c_7 - let expr_37 := _9 - let _10 := convert_t_rational_10_by_1_to_t_uint256(expr_36) - let expr_38 := checked_exp_t_rational_10_by_1_t_uint256(expr_37) - let vloc_y_35 := expr_38 - let expr_46 := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - let expr_47 := expr_46 - let _11 := vloc_d_9 - let expr_48 := _11 - let _12 := convert_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_to_t_uint256(expr_47) - let expr_49 := checked_exp_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_t_uint256(expr_48) - let vloc_z_41 := expr_49 - let expr_52 := 0x00 - let expr_53 := expr_52 - let _13 := vloc_a_3 - let expr_54 := _13 - let _14 := convert_t_rational_0_by_1_to_t_uint256(expr_53) - let expr_55 := checked_exp_t_rational_0_by_1_t_uint256(expr_54) - vloc_w_21 := expr_55 - let expr_56 := expr_55 - let expr_59 := 0x01 - let expr_60 := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - let expr_61 := expr_60 - let _15 := vloc_b_5 - let expr_62 := _15 - let _16 := convert_t_rational_minus_1_by_1_to_t_int256(expr_61) - let expr_63 := checked_exp_t_rational_minus_1_by_1_t_uint256(expr_62) - vloc_x_27 := expr_63 - let expr_64 := expr_63 - let expr_67 := 0x01 - let _17 := vloc_c_7 - let expr_68 := _17 - let _18 := convert_t_rational_1_by_1_to_t_uint256(expr_67) - let expr_69 := checked_exp_t_rational_1_by_1_t_uint256(expr_68) - vloc_y_35 := expr_69 - let expr_70 := expr_69 - let _19 := vloc_w_21 - let expr_72 := _19 - let expr_76_component_1 := expr_72 - let _20 := vloc_x_27 - let expr_73 := _20 - let expr_76_component_2 := expr_73 - let _21 := vloc_y_35 - let expr_74 := _21 - let expr_76_component_3 := expr_74 - let _22 := vloc_z_41 - let expr_75 := _22 - let expr_76_component_4 := expr_75 - vloc__12 := expr_76_component_1 - vloc__14 := expr_76_component_2 - vloc__16 := expr_76_component_3 - vloc__18 := expr_76_component_4 + let expr_23 := 0x02 + let _5 := vloc_a_4 + let expr_24 := _5 + let _6 := convert_t_rational_2_by_1_to_t_uint256(expr_23) + let expr_25 := checked_exp_t_rational_2_by_1_t_uint256(expr_24) + let vloc_w_22 := expr_25 + let expr_29 := 0x02 + let expr_30 := 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe + let expr_31 := expr_30 + let _7 := vloc_b_6 + let expr_32 := _7 + let _8 := convert_t_rational_minus_2_by_1_to_t_int256(expr_31) + let expr_33 := checked_exp_t_rational_minus_2_by_1_t_uint256(expr_32) + let vloc_x_28 := expr_33 + let expr_37 := 0x0a + let _9 := vloc_c_8 + let expr_38 := _9 + let _10 := convert_t_rational_10_by_1_to_t_uint256(expr_37) + let expr_39 := checked_exp_t_rational_10_by_1_t_uint256(expr_38) + let vloc_y_36 := expr_39 + let expr_47 := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + let expr_48 := expr_47 + let _11 := vloc_d_10 + let expr_49 := _11 + let _12 := convert_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_to_t_uint256(expr_48) + let expr_50 := checked_exp_t_rational_115792089237316195423570985008687907853269984665640564039457584007913129639935_by_1_t_uint256(expr_49) + let vloc_z_42 := expr_50 + let expr_53 := 0x00 + let expr_54 := expr_53 + let _13 := vloc_a_4 + let expr_55 := _13 + let _14 := convert_t_rational_0_by_1_to_t_uint256(expr_54) + let expr_56 := checked_exp_t_rational_0_by_1_t_uint256(expr_55) + vloc_w_22 := expr_56 + let expr_57 := expr_56 + let expr_60 := 0x01 + let expr_61 := 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + let expr_62 := expr_61 + let _15 := vloc_b_6 + let expr_63 := _15 + let _16 := convert_t_rational_minus_1_by_1_to_t_int256(expr_62) + let expr_64 := checked_exp_t_rational_minus_1_by_1_t_uint256(expr_63) + vloc_x_28 := expr_64 + let expr_65 := expr_64 + let expr_68 := 0x01 + let _17 := vloc_c_8 + let expr_69 := _17 + let _18 := convert_t_rational_1_by_1_to_t_uint256(expr_68) + let expr_70 := checked_exp_t_rational_1_by_1_t_uint256(expr_69) + vloc_y_36 := expr_70 + let expr_71 := expr_70 + let _19 := vloc_w_22 + let expr_73 := _19 + let expr_77_component_1 := expr_73 + let _20 := vloc_x_28 + let expr_74 := _20 + let expr_77_component_2 := expr_74 + let _21 := vloc_y_36 + let expr_75 := _21 + let expr_77_component_3 := expr_75 + let _22 := vloc_z_42 + let expr_76 := _22 + let expr_77_component_4 := expr_76 + vloc__13 := expr_77_component_1 + vloc__15 := expr_77_component_2 + vloc__17 := expr_77_component_3 + vloc__19 := expr_77_component_4 leave } diff --git a/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/input.sol b/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/input.sol index 8d523bd4d..097a2fbe9 100644 --- a/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/input.sol +++ b/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0; +pragma abicoder v2; contract C { constructor() {} diff --git a/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output b/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output index fd372367a..418676634 100644 --- a/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output +++ b/test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output @@ -6,17 +6,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "C_6" { +object "C_7" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("C_6_deployed") - codecopy(0, dataoffset("C_6_deployed"), _1) + let _1 := datasize("C_7_deployed") + codecopy(0, dataoffset("C_7_deployed"), _1) return(0, _1) } } - object "C_6_deployed" { + object "C_7_deployed" { code { { mstore(64, 128) @@ -34,17 +34,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "D_9" { +object "D_10" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("D_9_deployed") - codecopy(0, dataoffset("D_9_deployed"), _1) + let _1 := datasize("D_10_deployed") + codecopy(0, dataoffset("D_10_deployed"), _1) return(0, _1) } } - object "D_9_deployed" { + object "D_10_deployed" { code { { mstore(64, 128) diff --git a/test/cmdlineTests/ir_compiler_subobjects/err b/test/cmdlineTests/ir_compiler_subobjects/err index d4394af57..b300ec124 100644 --- a/test/cmdlineTests/ir_compiler_subobjects/err +++ b/test/cmdlineTests/ir_compiler_subobjects/err @@ -1,5 +1,5 @@ Warning: Unused local variable. - --> ir_compiler_subobjects/input.sol:7:9: + --> ir_compiler_subobjects/input.sol:8:9: | -7 | C c = new C(); +8 | C c = new C(); | ^^^ diff --git a/test/cmdlineTests/ir_compiler_subobjects/input.sol b/test/cmdlineTests/ir_compiler_subobjects/input.sol index 13f9f3c60..bad0fe74f 100644 --- a/test/cmdlineTests/ir_compiler_subobjects/input.sol +++ b/test/cmdlineTests/ir_compiler_subobjects/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0; +pragma abicoder v2; contract C {} contract D { diff --git a/test/cmdlineTests/ir_compiler_subobjects/output b/test/cmdlineTests/ir_compiler_subobjects/output index 7df119fa2..c0f66bfa3 100644 --- a/test/cmdlineTests/ir_compiler_subobjects/output +++ b/test/cmdlineTests/ir_compiler_subobjects/output @@ -6,17 +6,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "C_2" { +object "C_3" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("C_2_deployed") - codecopy(0, dataoffset("C_2_deployed"), _1) + let _1 := datasize("C_3_deployed") + codecopy(0, dataoffset("C_3_deployed"), _1) return(0, _1) } } - object "C_2_deployed" { + object "C_3_deployed" { code { { mstore(64, 128) @@ -34,17 +34,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "D_13" { +object "D_14" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("D_13_deployed") - codecopy(0, dataoffset("D_13_deployed"), _1) + let _1 := datasize("D_14_deployed") + codecopy(0, dataoffset("D_14_deployed"), _1) return(0, _1) } } - object "D_13_deployed" { + object "D_14_deployed" { code { { mstore(64, 128) @@ -55,10 +55,10 @@ object "D_13" { { if callvalue() { revert(_1, _1) } if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) } - let _2 := datasize("C_2") + let _2 := datasize("C_3") let _3 := add(128, _2) if or(gt(_3, 0xffffffffffffffff), lt(_3, 128)) { invalid() } - datacopy(128, dataoffset("C_2"), _2) + datacopy(128, dataoffset("C_3"), _2) if iszero(create(_1, 128, _2)) { returndatacopy(_1, _1, returndatasize()) @@ -77,17 +77,17 @@ object "D_13" { mstore(64, newFreePtr) } } - object "C_2" { + object "C_3" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("C_2_deployed") - codecopy(0, dataoffset("C_2_deployed"), _1) + let _1 := datasize("C_3_deployed") + codecopy(0, dataoffset("C_3_deployed"), _1) return(0, _1) } } - object "C_2_deployed" { + object "C_3_deployed" { code { { mstore(64, 128) diff --git a/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/input.sol b/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/input.sol index 6dd033f13..aca9b3bef 100644 --- a/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/input.sol +++ b/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.0.0; +pragma abicoder v2; contract D { constructor() { assembly {}} diff --git a/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/output b/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/output index 35c3f4473..e4ad6b298 100644 --- a/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/output +++ b/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/output @@ -6,17 +6,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "D_11" { +object "D_12" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("D_11_deployed") - codecopy(0, dataoffset("D_11_deployed"), _1) + let _1 := datasize("D_12_deployed") + codecopy(0, dataoffset("D_12_deployed"), _1) return(0, _1) } } - object "D_11_deployed" { + object "D_12_deployed" { code { { mstore(64, 128) diff --git a/test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/input.sol b/test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/input.sol index caef2b75e..e217f9cbb 100644 --- a/test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/input.sol +++ b/test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.0.0; +pragma abicoder v2; contract D { function f() public pure { diff --git a/test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/output b/test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/output index 601d941a2..cf559e4bd 100644 --- a/test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/output +++ b/test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/output @@ -6,17 +6,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "D_7" { +object "D_8" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("D_7_deployed") - codecopy(0, dataoffset("D_7_deployed"), _1) + let _1 := datasize("D_8_deployed") + codecopy(0, dataoffset("D_8_deployed"), _1) return(0, _1) } } - object "D_7_deployed" { + object "D_8_deployed" { code { { mstore(64, 128) diff --git a/test/cmdlineTests/optimizer_array_sload/input.sol b/test/cmdlineTests/optimizer_array_sload/input.sol index 3c8c3d212..94f42219a 100644 --- a/test/cmdlineTests/optimizer_array_sload/input.sol +++ b/test/cmdlineTests/optimizer_array_sload/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.0; +pragma abicoder v2; contract Arraysum { uint256[] values; diff --git a/test/cmdlineTests/optimizer_array_sload/output b/test/cmdlineTests/optimizer_array_sload/output index 901d1b22a..331c71f23 100644 --- a/test/cmdlineTests/optimizer_array_sload/output +++ b/test/cmdlineTests/optimizer_array_sload/output @@ -6,17 +6,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "Arraysum_33" { +object "Arraysum_34" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("Arraysum_33_deployed") - codecopy(0, dataoffset("Arraysum_33_deployed"), _1) + let _1 := datasize("Arraysum_34_deployed") + codecopy(0, dataoffset("Arraysum_34_deployed"), _1) return(0, _1) } } - object "Arraysum_33_deployed" { + object "Arraysum_34_deployed" { code { { mstore(64, 128) diff --git a/test/cmdlineTests/standard_ewasm_requested/input.json b/test/cmdlineTests/standard_ewasm_requested/input.json index d3c6cc892..53dcc68ee 100644 --- a/test/cmdlineTests/standard_ewasm_requested/input.json +++ b/test/cmdlineTests/standard_ewasm_requested/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C { }" + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { }" } }, "settings": diff --git a/test/cmdlineTests/standard_ewasm_requested/output.json b/test/cmdlineTests/standard_ewasm_requested/output.json index f8ed91e85..b63bc50dc 100644 --- a/test/cmdlineTests/standard_ewasm_requested/output.json +++ b/test/cmdlineTests/standard_ewasm_requested/output.json @@ -1,7 +1,7 @@ -{"contracts":{"A":{"C":{"ewasm":{"wasm":"0061736d01000000013a0860000060017e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e00600c7e7e7e7e7e7e7e7e7e7e7e7e0060017f0060027f7f0060037f7f7f0002510408657468657265756d08636f6465436f7079000708657468657265756d06726576657274000608657468657265756d0c67657443616c6c56616c7565000508657468657265756d0666696e6973680006030a090002020101010403030503010001060100071102066d656d6f72790200046d61696e0004009d030c435f325f6465706c6f7965640061736d0100000001160460000060017e017e60047e7e7e7e017f60027f7f0002130108657468657265756d067265766572740003030504000201010503010001060100071102066d656d6f72790200046d61696e00010ab60204ca0104017e027f057e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b20001003421086210320032000421088100384422086210420042000422088100484210520022005370000200241086a2005370000200241106a20053700004280011003421086210620064280014210881003844220862107200241186a2007428001422088100484370000200020002000200010022108200020002000200010022109200941c0006a210a200a2009490440000b200a200810000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100342108621022002200042108810038421010b20010b0aec0309dc0103017e027f057e02404200210020002000200042c00010052101200141c0006a210220022001490440000b20001009210320022003370000200241086a2003370000200241106a2003370000200241186a428001100937000041001002410029000010092104410041086a29000010092105410041106a2900001009210620042005842006410041186a290000100984845045044020002000200020002000200020002000100c0b4290032107200020002000200020002000200042ce012000200020002007100a20002000200020002000200020002007100b0b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b2601027f0240200020012002200310052105200541c0006a210420042005490440000b0b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100742108621022002200042108810078421010b20010b1e01027e02402000100842208621022002200042208810088421010b20010b25000240200020012002200310062004200520062007100520082009200a200b100510000b0b1b000240200020012002200310062004200520062007100510030b0b1b000240200020012002200310062004200520062007100510010b0b","wast":"(module +{"contracts":{"A":{"C":{"ewasm":{"wasm":"0061736d01000000013a0860000060017e017e60047e7e7e7e017f60087e7e7e7e7e7e7e7e00600c7e7e7e7e7e7e7e7e7e7e7e7e0060017f0060027f7f0060037f7f7f0002510408657468657265756d08636f6465436f7079000708657468657265756d06726576657274000608657468657265756d0c67657443616c6c56616c7565000508657468657265756d0666696e6973680006030a090002020101010403030503010001060100071102066d656d6f72790200046d61696e0004009d030c435f335f6465706c6f7965640061736d0100000001160460000060017e017e60047e7e7e7e017f60027f7f0002130108657468657265756d067265766572740003030504000201010503010001060100071102066d656d6f72790200046d61696e00010ab60204ca0104017e027f057e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b20001003421086210320032000421088100384422086210420042000422088100484210520022005370000200241086a2005370000200241106a20053700004280011003421086210620064280014210881003844220862107200241186a2007428001422088100484370000200020002000200010022108200020002000200010022109200941c0006a210a200a2009490440000b200a200810000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100342108621022002200042108810038421010b20010b0aec0309dc0103017e027f057e02404200210020002000200042c00010052101200141c0006a210220022001490440000b20001009210320022003370000200241086a2003370000200241106a2003370000200241186a428001100937000041001002410029000010092104410041086a29000010092105410041106a2900001009210620042005842006410041186a290000100984845045044020002000200020002000200020002000100c0b4290032107200020002000200020002000200042ce012000200020002007100a20002000200020002000200020002007100b0b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b2601027f0240200020012002200310052105200541c0006a210420042005490440000b0b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100742108621022002200042108810078421010b20010b1e01027e02402000100842208621022002200042208810088421010b20010b25000240200020012002200310062004200520062007100520082009200a200b100510000b0b1b000240200020012002200310062004200520062007100510030b0b1b000240200020012002200310062004200520062007100510010b0b","wast":"(module ;; custom section for sub-module - ;; The Keccak-256 hash of the text representation of \"C_2_deployed\": 0289c074ac70ccfdbeb7817862087cc066a9f7707de1a981bb8b5b12dd2ce4e9 - ;; (@custom \"C_2_deployed\" \"0061736d0100000001160460000060017e017e60047e7e7e7e017f60027f7f0002130108657468657265756d067265766572740003030504000201010503010001060100071102066d656d6f72790200046d61696e00010ab60204ca0104017e027f057e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b20001003421086210320032000421088100384422086210420042000422088100484210520022005370000200241086a2005370000200241106a20053700004280011003421086210620064280014210881003844220862107200241186a2007428001422088100484370000200020002000200010022108200020002000200010022109200941c0006a210a200a2009490440000b200a200810000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100342108621022002200042108810038421010b20010b\") + ;; The Keccak-256 hash of the text representation of \"C_3_deployed\": 0289c074ac70ccfdbeb7817862087cc066a9f7707de1a981bb8b5b12dd2ce4e9 + ;; (@custom \"C_3_deployed\" \"0061736d0100000001160460000060017e017e60047e7e7e7e017f60027f7f0002130108657468657265756d067265766572740003030504000201010503010001060100071102066d656d6f72790200046d61696e00010ab60204ca0104017e027f057e037f02404200210020002000200042c00010022101200141c0006a210220022001490440000b20001003421086210320032000421088100384422086210420042000422088100484210520022005370000200241086a2005370000200241106a20053700004280011003421086210620064280014210881003844220862107200241186a2007428001422088100484370000200020002000200010022108200020002000200010022109200941c0006a210a200a2009490440000b200a200810000b0b2901017f024042002000200184200284520440000b42002003422088520440000b2003a721040b20040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100342108621022002200042108810038421010b20010b\") (import \"ethereum\" \"codeCopy\" (func $eth.codeCopy (param i32 i32 i32))) (import \"ethereum\" \"revert\" (func $eth.revert (param i32 i32))) (import \"ethereum\" \"getCallValue\" (func $eth.getCallValue (param i32))) @@ -35,8 +35,8 @@ (local.set $z3 (call $bswap64 (i64.load (i32.add (i32.const 0) (i32.const 16))))) (if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $z1) (local.get $z2)) (i64.or (local.get $z3) (call $bswap64 (i64.load (i32.add (i32.const 0) (i32.const 24)))))))) (then (call $revert (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1)))) - (local.set $_3 (datasize \"C_2_deployed\")) - (call $codecopy (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_2_deployed\") (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3)) + (local.set $_3 (datasize \"C_3_deployed\")) + (call $codecopy (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (dataoffset \"C_3_deployed\") (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3)) (call $return (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_3)) ) ) diff --git a/test/cmdlineTests/standard_ewasm_requested_abstract/input.json b/test/cmdlineTests/standard_ewasm_requested_abstract/input.json index 313fa478c..2ee666fe2 100644 --- a/test/cmdlineTests/standard_ewasm_requested_abstract/input.json +++ b/test/cmdlineTests/standard_ewasm_requested_abstract/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; abstract contract C { }" + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; abstract contract C { }" } }, "settings": diff --git a/test/cmdlineTests/standard_irOptimized_requested/input.json b/test/cmdlineTests/standard_irOptimized_requested/input.json index 09aa37bae..48e5c7b0a 100644 --- a/test/cmdlineTests/standard_irOptimized_requested/input.json +++ b/test/cmdlineTests/standard_irOptimized_requested/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C { function f() public pure {} }" + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { function f() public pure {} }" } }, "settings": diff --git a/test/cmdlineTests/standard_irOptimized_requested/output.json b/test/cmdlineTests/standard_irOptimized_requested/output.json index dd7c82123..1da912297 100644 --- a/test/cmdlineTests/standard_irOptimized_requested/output.json +++ b/test/cmdlineTests/standard_irOptimized_requested/output.json @@ -5,17 +5,17 @@ * !USE AT YOUR OWN RISK! * *******************************************************/ -object \"C_6\" { +object \"C_7\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_6() - codecopy(0, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\")) - return(0, datasize(\"C_6_deployed\")) - function constructor_C_6() + constructor_C_7() + codecopy(0, dataoffset(\"C_7_deployed\"), datasize(\"C_7_deployed\")) + return(0, datasize(\"C_7_deployed\")) + function constructor_C_7() { } } - object \"C_6_deployed\" { + object \"C_7_deployed\" { code { mstore(64, 128) if iszero(lt(calldatasize(), 4)) @@ -25,7 +25,7 @@ object \"C_6\" { case 0x26121ff0 { if callvalue() { revert(0, 0) } abi_decode_tuple_(4, calldatasize()) - fun_f_5() + fun_f_6() let memPos := allocateMemory(0) let memEnd := abi_encode_tuple__to__fromStack(memPos) return(memPos, sub(memEnd, memPos)) @@ -47,7 +47,7 @@ object \"C_6\" { if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() } mstore(64, newFreePtr) } - function fun_f_5() + function fun_f_6() { } function panic_error() { invalid() } diff --git a/test/cmdlineTests/standard_ir_requested/input.json b/test/cmdlineTests/standard_ir_requested/input.json index cc0a91df9..6eb5295c5 100644 --- a/test/cmdlineTests/standard_ir_requested/input.json +++ b/test/cmdlineTests/standard_ir_requested/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C { function f() public pure {} }" + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { function f() public pure {} }" } }, "settings": diff --git a/test/cmdlineTests/standard_ir_requested/output.json b/test/cmdlineTests/standard_ir_requested/output.json index d46256ee7..c5a91cbd7 100644 --- a/test/cmdlineTests/standard_ir_requested/output.json +++ b/test/cmdlineTests/standard_ir_requested/output.json @@ -6,23 +6,23 @@ *******************************************************/ -object \"C_6\" { +object \"C_7\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_6() + constructor_C_7() - codecopy(0, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\")) + codecopy(0, dataoffset(\"C_7_deployed\"), datasize(\"C_7_deployed\")) - return(0, datasize(\"C_6_deployed\")) + return(0, datasize(\"C_7_deployed\")) - function constructor_C_6() { + function constructor_C_7() { } } - object \"C_6_deployed\" { + object \"C_7_deployed\" { code { mstore(64, 128) @@ -36,7 +36,7 @@ object \"C_6\" { // f() if callvalue() { revert(0, 0) } abi_decode_tuple_(4, calldatasize()) - fun_f_5() + fun_f_6() let memPos := allocateMemory(0) let memEnd := abi_encode_tuple__to__fromStack(memPos ) return(memPos, sub(memEnd, memPos)) @@ -65,7 +65,7 @@ object \"C_6\" { mstore(64, newFreePtr) } - function fun_f_5() { + function fun_f_6() { } diff --git a/test/cmdlineTests/standard_viair_requested/input.json b/test/cmdlineTests/standard_viair_requested/input.json index 6a970357e..76ae807a6 100644 --- a/test/cmdlineTests/standard_viair_requested/input.json +++ b/test/cmdlineTests/standard_viair_requested/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C {} contract D { function f() public { C c = new C(); } }" + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C {} contract D { function f() public { C c = new C(); } }" } }, "settings": diff --git a/test/cmdlineTests/standard_viair_requested/output.json b/test/cmdlineTests/standard_viair_requested/output.json index f48dcf52f..5f280417c 100644 --- a/test/cmdlineTests/standard_viair_requested/output.json +++ b/test/cmdlineTests/standard_viair_requested/output.json @@ -6,23 +6,23 @@ *******************************************************/ -object \"C_2\" { +object \"C_3\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_2() + constructor_C_3() - codecopy(0, dataoffset(\"C_2_deployed\"), datasize(\"C_2_deployed\")) + codecopy(0, dataoffset(\"C_3_deployed\"), datasize(\"C_3_deployed\")) - return(0, datasize(\"C_2_deployed\")) + return(0, datasize(\"C_3_deployed\")) - function constructor_C_2() { + function constructor_C_3() { } } - object \"C_2_deployed\" { + object \"C_3_deployed\" { code { mstore(64, 128) @@ -57,23 +57,23 @@ object \"C_2\" { *******************************************************/ -object \"D_13\" { +object \"D_14\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_D_13() + constructor_D_14() - codecopy(0, dataoffset(\"D_13_deployed\"), datasize(\"D_13_deployed\")) + codecopy(0, dataoffset(\"D_14_deployed\"), datasize(\"D_14_deployed\")) - return(0, datasize(\"D_13_deployed\")) + return(0, datasize(\"D_14_deployed\")) - function constructor_D_13() { + function constructor_D_14() { } } - object \"D_13_deployed\" { + object \"D_14_deployed\" { code { mstore(64, 128) @@ -87,7 +87,7 @@ object \"D_13\" { // f() if callvalue() { revert(0, 0) } abi_decode_tuple_(4, calldatasize()) - fun_f_12() + fun_f_13() let memPos := allocateMemory(0) let memEnd := abi_encode_tuple__to__fromStack(memPos ) return(memPos, sub(memEnd, memPos)) @@ -120,20 +120,20 @@ object \"D_13\" { memPtr := mload(64) } - function fun_f_12() { + function fun_f_13() { let _1 := allocateTemporaryMemory() - let _2 := add(_1, datasize(\"C_2\")) + let _2 := add(_1, datasize(\"C_3\")) if or(gt(_2, 0xffffffffffffffff), lt(_2, _1)) { panic_error() } - datacopy(_1, dataoffset(\"C_2\"), datasize(\"C_2\")) + datacopy(_1, dataoffset(\"C_3\"), datasize(\"C_3\")) _2 := abi_encode_tuple__to__fromStack(_2) - let expr_9_address := create(0, _1, sub(_2, _1)) + let expr_10_address := create(0, _1, sub(_2, _1)) - if iszero(expr_9_address) { revert_forward_1() } + if iszero(expr_10_address) { revert_forward_1() } releaseTemporaryMemory() - let vloc_c_6_address := expr_9_address + let vloc_c_7_address := expr_10_address } @@ -164,23 +164,23 @@ object \"D_13\" { * !USE AT YOUR OWN RISK! * *******************************************************/ - object \"C_2\" { + object \"C_3\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_2() + constructor_C_3() - codecopy(0, dataoffset(\"C_2_deployed\"), datasize(\"C_2_deployed\")) + codecopy(0, dataoffset(\"C_3_deployed\"), datasize(\"C_3_deployed\")) - return(0, datasize(\"C_2_deployed\")) + return(0, datasize(\"C_3_deployed\")) - function constructor_C_2() { + function constructor_C_3() { } } - object \"C_2_deployed\" { + object \"C_3_deployed\" { code { mstore(64, 128) @@ -211,7 +211,7 @@ object \"D_13\" { } -"}}},"errors":[{"component":"general","errorCode":"2072","formattedMessage":"A:2:73: Warning: Unused local variable. -pragma solidity >=0.0; contract C {} contract D { function f() public { C c = new C(); } } - ^-^ -","message":"Unused local variable.","severity":"warning","sourceLocation":{"end":111,"file":"A","start":108},"type":"Warning"}],"sources":{"A":{"id":0}}} +"}}},"errors":[{"component":"general","errorCode":"2072","formattedMessage":"A:2:93: Warning: Unused local variable. +pragma solidity >=0.0; pragma abicoder v2; contract C {} contract D { function f() public { C c = new C(); } } + ^-^ +","message":"Unused local variable.","severity":"warning","sourceLocation":{"end":131,"file":"A","start":128},"type":"Warning"}],"sources":{"A":{"id":0}}} diff --git a/test/cmdlineTests/viair_abicoder_v1/args b/test/cmdlineTests/viair_abicoder_v1/args new file mode 100644 index 000000000..e869749f2 --- /dev/null +++ b/test/cmdlineTests/viair_abicoder_v1/args @@ -0,0 +1 @@ +--ir --error-codes diff --git a/test/cmdlineTests/viair_abicoder_v1/err b/test/cmdlineTests/viair_abicoder_v1/err new file mode 100644 index 000000000..55f8ba4b9 --- /dev/null +++ b/test/cmdlineTests/viair_abicoder_v1/err @@ -0,0 +1,5 @@ +Warning (2066): Contract requests the ABI coder v1, which is incompatible with the IR. Using ABI coder v2 instead. + --> viair_abicoder_v1/input.sol:4:1: + | +4 | contract test { + | ^ (Relevant source part starts here and spans across multiple lines). diff --git a/test/cmdlineTests/viair_abicoder_v1/input.sol b/test/cmdlineTests/viair_abicoder_v1/input.sol new file mode 100644 index 000000000..198e40e16 --- /dev/null +++ b/test/cmdlineTests/viair_abicoder_v1/input.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; +pragma abicoder v1; +contract test { + function f() public pure returns (bool) { + return true; + } +} diff --git a/test/cmdlineTests/viair_abicoder_v1/output b/test/cmdlineTests/viair_abicoder_v1/output new file mode 100644 index 000000000..2aec15e28 --- /dev/null +++ b/test/cmdlineTests/viair_abicoder_v1/output @@ -0,0 +1,108 @@ +IR: +/******************************************************* + * WARNING * + * Solidity to Yul compilation is still EXPERIMENTAL * + * It can result in LOSS OF FUNDS or worse * + * !USE AT YOUR OWN RISK! * + *******************************************************/ + + +object "test_11" { + code { + mstore(64, 128) + if callvalue() { revert(0, 0) } + + constructor_test_11() + + codecopy(0, dataoffset("test_11_deployed"), datasize("test_11_deployed")) + + return(0, datasize("test_11_deployed")) + + function constructor_test_11() { + + } + + } + object "test_11_deployed" { + code { + mstore(64, 128) + + if iszero(lt(calldatasize(), 4)) + { + let selector := shift_right_224_unsigned(calldataload(0)) + switch selector + + case 0x26121ff0 + { + // f() + if callvalue() { revert(0, 0) } + abi_decode_tuple_(4, calldatasize()) + let ret_0 := fun_f_10() + let memPos := allocateMemory(0) + let memEnd := abi_encode_tuple_t_bool__to_t_bool__fromStack(memPos , ret_0) + return(memPos, sub(memEnd, memPos)) + } + + default {} + } + if iszero(calldatasize()) { } + revert(0, 0) + + function abi_decode_tuple_(headStart, dataEnd) { + if slt(sub(dataEnd, headStart), 0) { revert(0, 0) } + + } + + function abi_encode_t_bool_to_t_bool_fromStack(value, pos) { + mstore(pos, cleanup_t_bool(value)) + } + + function abi_encode_tuple_t_bool__to_t_bool__fromStack(headStart , value0) -> tail { + tail := add(headStart, 32) + + abi_encode_t_bool_to_t_bool_fromStack(value0, add(headStart, 0)) + + } + + function allocateMemory(size) -> memPtr { + memPtr := mload(64) + let newFreePtr := add(memPtr, size) + // protect against overflow + if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() } + mstore(64, newFreePtr) + } + + function cleanup_t_bool(value) -> cleaned { + cleaned := iszero(iszero(value)) + } + + function fun_f_10() -> vloc__5 { + let zero_value_for_type_t_bool_1 := zero_value_for_split_t_bool() + vloc__5 := zero_value_for_type_t_bool_1 + + let expr_7 := 0x01 + vloc__5 := expr_7 + leave + + } + + function panic_error() { + invalid() + } + + function shift_right_224_unsigned(value) -> newValue { + newValue := + + shr(224, value) + + } + + function zero_value_for_split_t_bool() -> ret { + ret := 0 + } + + } + + } + +} diff --git a/test/cmdlineTests/viair_subobjects/err b/test/cmdlineTests/viair_subobjects/err index c355ba16e..5046525be 100644 --- a/test/cmdlineTests/viair_subobjects/err +++ b/test/cmdlineTests/viair_subobjects/err @@ -1,5 +1,5 @@ Warning: Unused local variable. - --> viair_subobjects/input.sol:7:9: + --> viair_subobjects/input.sol:8:9: | -7 | C c = new C(); +8 | C c = new C(); | ^^^ diff --git a/test/cmdlineTests/viair_subobjects/input.sol b/test/cmdlineTests/viair_subobjects/input.sol index 13f9f3c60..bad0fe74f 100644 --- a/test/cmdlineTests/viair_subobjects/input.sol +++ b/test/cmdlineTests/viair_subobjects/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.0; +pragma abicoder v2; contract C {} contract D { diff --git a/test/cmdlineTests/viair_subobjects/output b/test/cmdlineTests/viair_subobjects/output index 91928ffb7..c3b5a4cea 100644 --- a/test/cmdlineTests/viair_subobjects/output +++ b/test/cmdlineTests/viair_subobjects/output @@ -12,17 +12,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "C_2" { +object "C_3" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("C_2_deployed") - codecopy(0, dataoffset("C_2_deployed"), _1) + let _1 := datasize("C_3_deployed") + codecopy(0, dataoffset("C_3_deployed"), _1) return(0, _1) } } - object "C_2_deployed" { + object "C_3_deployed" { code { { mstore(64, 128) @@ -46,17 +46,17 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "D_13" { +object "D_14" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("D_13_deployed") - codecopy(0, dataoffset("D_13_deployed"), _1) + let _1 := datasize("D_14_deployed") + codecopy(0, dataoffset("D_14_deployed"), _1) return(0, _1) } } - object "D_13_deployed" { + object "D_14_deployed" { code { { mstore(64, 128) @@ -67,10 +67,10 @@ object "D_13" { { if callvalue() { revert(_1, _1) } if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) } - let _2 := datasize("C_2") + let _2 := datasize("C_3") let _3 := add(128, _2) if or(gt(_3, 0xffffffffffffffff), lt(_3, 128)) { invalid() } - datacopy(128, dataoffset("C_2"), _2) + datacopy(128, dataoffset("C_3"), _2) if iszero(create(_1, 128, _2)) { returndatacopy(_1, _1, returndatasize()) @@ -89,17 +89,17 @@ object "D_13" { mstore(64, newFreePtr) } } - object "C_2" { + object "C_3" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - let _1 := datasize("C_2_deployed") - codecopy(0, dataoffset("C_2_deployed"), _1) + let _1 := datasize("C_3_deployed") + codecopy(0, dataoffset("C_3_deployed"), _1) return(0, _1) } } - object "C_2_deployed" { + object "C_3_deployed" { code { { mstore(64, 128) diff --git a/test/cmdlineTests/yul_optimizer_steps/input.sol b/test/cmdlineTests/yul_optimizer_steps/input.sol index c93363e41..260b21cd5 100644 --- a/test/cmdlineTests/yul_optimizer_steps/input.sol +++ b/test/cmdlineTests/yul_optimizer_steps/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.0; +pragma abicoder v2; contract C { diff --git a/test/cmdlineTests/yul_optimizer_steps/output b/test/cmdlineTests/yul_optimizer_steps/output index 847c731e9..c06add7c7 100644 --- a/test/cmdlineTests/yul_optimizer_steps/output +++ b/test/cmdlineTests/yul_optimizer_steps/output @@ -6,16 +6,16 @@ Optimized IR: * !USE AT YOUR OWN RISK! * *******************************************************/ -object "C_6" { +object "C_7" { code { { mstore(64, 128) if callvalue() { revert(0, 0) } - codecopy(0, dataoffset("C_6_deployed"), datasize("C_6_deployed")) - return(0, datasize("C_6_deployed")) + codecopy(0, dataoffset("C_7_deployed"), datasize("C_7_deployed")) + return(0, datasize("C_7_deployed")) } } - object "C_6_deployed" { + object "C_7_deployed" { code { { mstore(64, 128) diff --git a/test/cmdlineTests/yul_string_format_ascii/input.json b/test/cmdlineTests/yul_string_format_ascii/input.json index 0eba555c9..7b86b65cd 100644 --- a/test/cmdlineTests/yul_string_format_ascii/input.json +++ b/test/cmdlineTests/yul_string_format_ascii/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C { function f() external pure returns (string memory) { return \"abcabc\"; } }" + "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { function f() external pure returns (string memory) { return \"abcabc\"; } }" } }, "settings": diff --git a/test/cmdlineTests/yul_string_format_ascii/output.json b/test/cmdlineTests/yul_string_format_ascii/output.json index b6615773f..f00bb751c 100644 --- a/test/cmdlineTests/yul_string_format_ascii/output.json +++ b/test/cmdlineTests/yul_string_format_ascii/output.json @@ -6,23 +6,23 @@ *******************************************************/ -object \"C_10\" { +object \"C_11\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_10() + constructor_C_11() - codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\")) + codecopy(0, dataoffset(\"C_11_deployed\"), datasize(\"C_11_deployed\")) - return(0, datasize(\"C_10_deployed\")) + return(0, datasize(\"C_11_deployed\")) - function constructor_C_10() { + function constructor_C_11() { } } - object \"C_10_deployed\" { + object \"C_11_deployed\" { code { mstore(64, 128) @@ -36,7 +36,7 @@ object \"C_10\" { // f() if callvalue() { revert(0, 0) } abi_decode_tuple_(4, calldatasize()) - let ret_0 := fun_f_9() + let ret_0 := fun_f_10() let memPos := allocateMemory(0) let memEnd := abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack(memPos , ret_0) return(memPos, sub(memEnd, memPos)) @@ -107,11 +107,11 @@ object \"C_10\" { } } - function fun_f_9() -> vloc__4_mpos { + function fun_f_10() -> vloc__5_mpos { let zero_value_for_type_t_string_memory_ptr_1_mpos := zero_value_for_split_t_string_memory_ptr() - vloc__4_mpos := zero_value_for_type_t_string_memory_ptr_1_mpos + vloc__5_mpos := zero_value_for_type_t_string_memory_ptr_1_mpos - vloc__4_mpos := convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_string_memory_ptr() + vloc__5_mpos := convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_string_memory_ptr() leave } diff --git a/test/cmdlineTests/yul_string_format_ascii_bytes32/input.json b/test/cmdlineTests/yul_string_format_ascii_bytes32/input.json index 3dbcdb819..cb9318f33 100644 --- a/test/cmdlineTests/yul_string_format_ascii_bytes32/input.json +++ b/test/cmdlineTests/yul_string_format_ascii_bytes32/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C { function f() external pure returns (bytes32) { return \"abcabc\"; } }" + "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { function f() external pure returns (bytes32) { return \"abcabc\"; } }" } }, "settings": diff --git a/test/cmdlineTests/yul_string_format_ascii_bytes32/output.json b/test/cmdlineTests/yul_string_format_ascii_bytes32/output.json index 457a301ca..bab7235d2 100644 --- a/test/cmdlineTests/yul_string_format_ascii_bytes32/output.json +++ b/test/cmdlineTests/yul_string_format_ascii_bytes32/output.json @@ -6,23 +6,23 @@ *******************************************************/ -object \"C_10\" { +object \"C_11\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_10() + constructor_C_11() - codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\")) + codecopy(0, dataoffset(\"C_11_deployed\"), datasize(\"C_11_deployed\")) - return(0, datasize(\"C_10_deployed\")) + return(0, datasize(\"C_11_deployed\")) - function constructor_C_10() { + function constructor_C_11() { } } - object \"C_10_deployed\" { + object \"C_11_deployed\" { code { mstore(64, 128) @@ -36,7 +36,7 @@ object \"C_10\" { // f() if callvalue() { revert(0, 0) } abi_decode_tuple_(4, calldatasize()) - let ret_0 := fun_f_9() + let ret_0 := fun_f_10() let memPos := allocateMemory(0) let memEnd := abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack(memPos , ret_0) return(memPos, sub(memEnd, memPos)) @@ -79,11 +79,11 @@ object \"C_10\" { converted := 0x6162636162630000000000000000000000000000000000000000000000000000 } - function fun_f_9() -> vloc__4 { + function fun_f_10() -> vloc__5 { let zero_value_for_type_t_bytes32_1 := zero_value_for_split_t_bytes32() - vloc__4 := zero_value_for_type_t_bytes32_1 + vloc__5 := zero_value_for_type_t_bytes32_1 - vloc__4 := convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_bytes32() + vloc__5 := convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_bytes32() leave } diff --git a/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/input.json b/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/input.json index 003dddfa7..fa45bb240 100644 --- a/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/input.json +++ b/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C { function f() external pure returns (bytes4) { return 0x61626364; } }" + "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { function f() external pure returns (bytes4) { return 0x61626364; } }" } }, "settings": diff --git a/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/output.json b/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/output.json index 673315c3f..c1d6cfec7 100644 --- a/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/output.json +++ b/test/cmdlineTests/yul_string_format_ascii_bytes32_from_number/output.json @@ -6,23 +6,23 @@ *******************************************************/ -object \"C_10\" { +object \"C_11\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_10() + constructor_C_11() - codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\")) + codecopy(0, dataoffset(\"C_11_deployed\"), datasize(\"C_11_deployed\")) - return(0, datasize(\"C_10_deployed\")) + return(0, datasize(\"C_11_deployed\")) - function constructor_C_10() { + function constructor_C_11() { } } - object \"C_10_deployed\" { + object \"C_11_deployed\" { code { mstore(64, 128) @@ -36,7 +36,7 @@ object \"C_10\" { // f() if callvalue() { revert(0, 0) } abi_decode_tuple_(4, calldatasize()) - let ret_0 := fun_f_9() + let ret_0 := fun_f_10() let memPos := allocateMemory(0) let memEnd := abi_encode_tuple_t_bytes4__to_t_bytes4__fromStack(memPos , ret_0) return(memPos, sub(memEnd, memPos)) @@ -83,12 +83,12 @@ object \"C_10\" { converted := shift_left_224(cleanup_t_rational_1633837924_by_1(value)) } - function fun_f_9() -> vloc__4 { + function fun_f_10() -> vloc__5 { let zero_value_for_type_t_bytes4_1 := zero_value_for_split_t_bytes4() - vloc__4 := zero_value_for_type_t_bytes4_1 + vloc__5 := zero_value_for_type_t_bytes4_1 - let expr_6 := 0x61626364 - vloc__4 := convert_t_rational_1633837924_by_1_to_t_bytes4(expr_6) + let expr_7 := 0x61626364 + vloc__5 := convert_t_rational_1633837924_by_1_to_t_bytes4(expr_7) leave } diff --git a/test/cmdlineTests/yul_string_format_ascii_long/input.json b/test/cmdlineTests/yul_string_format_ascii_long/input.json index 5d91e402e..b55efa913 100644 --- a/test/cmdlineTests/yul_string_format_ascii_long/input.json +++ b/test/cmdlineTests/yul_string_format_ascii_long/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C { function f() external pure returns (string memory) { return \"abcdabcdcafecafeabcdabcdcafecafeffffzzzzoooo0123456789,.<,>.?:;'[{]}|`~!@#$%^&*()-_=+\"; } }" + "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { function f() external pure returns (string memory) { return \"abcdabcdcafecafeabcdabcdcafecafeffffzzzzoooo0123456789,.<,>.?:;'[{]}|`~!@#$%^&*()-_=+\"; } }" } }, "settings": diff --git a/test/cmdlineTests/yul_string_format_ascii_long/output.json b/test/cmdlineTests/yul_string_format_ascii_long/output.json index 3e5052af0..8a1025a46 100644 --- a/test/cmdlineTests/yul_string_format_ascii_long/output.json +++ b/test/cmdlineTests/yul_string_format_ascii_long/output.json @@ -6,23 +6,23 @@ *******************************************************/ -object \"C_10\" { +object \"C_11\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_10() + constructor_C_11() - codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\")) + codecopy(0, dataoffset(\"C_11_deployed\"), datasize(\"C_11_deployed\")) - return(0, datasize(\"C_10_deployed\")) + return(0, datasize(\"C_11_deployed\")) - function constructor_C_10() { + function constructor_C_11() { } } - object \"C_10_deployed\" { + object \"C_11_deployed\" { code { mstore(64, 128) @@ -36,7 +36,7 @@ object \"C_10\" { // f() if callvalue() { revert(0, 0) } abi_decode_tuple_(4, calldatasize()) - let ret_0 := fun_f_9() + let ret_0 := fun_f_10() let memPos := allocateMemory(0) let memEnd := abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack(memPos , ret_0) return(memPos, sub(memEnd, memPos)) @@ -111,11 +111,11 @@ object \"C_10\" { } } - function fun_f_9() -> vloc__4_mpos { + function fun_f_10() -> vloc__5_mpos { let zero_value_for_type_t_string_memory_ptr_1_mpos := zero_value_for_split_t_string_memory_ptr() - vloc__4_mpos := zero_value_for_type_t_string_memory_ptr_1_mpos + vloc__5_mpos := zero_value_for_type_t_string_memory_ptr_1_mpos - vloc__4_mpos := convert_t_stringliteral_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571_to_t_string_memory_ptr() + vloc__5_mpos := convert_t_stringliteral_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571_to_t_string_memory_ptr() leave } diff --git a/test/cmdlineTests/yul_string_format_hex/input.json b/test/cmdlineTests/yul_string_format_hex/input.json index 9bb3fd138..51d3dcdff 100644 --- a/test/cmdlineTests/yul_string_format_hex/input.json +++ b/test/cmdlineTests/yul_string_format_hex/input.json @@ -4,7 +4,7 @@ { "A": { - "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C { function f() external pure returns (bytes4) { return 0xaabbccdd; } }" + "content": "//SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { function f() external pure returns (bytes4) { return 0xaabbccdd; } }" } }, "settings": diff --git a/test/cmdlineTests/yul_string_format_hex/output.json b/test/cmdlineTests/yul_string_format_hex/output.json index 9f1ac4b5e..48fca31e8 100644 --- a/test/cmdlineTests/yul_string_format_hex/output.json +++ b/test/cmdlineTests/yul_string_format_hex/output.json @@ -6,23 +6,23 @@ *******************************************************/ -object \"C_10\" { +object \"C_11\" { code { mstore(64, 128) if callvalue() { revert(0, 0) } - constructor_C_10() + constructor_C_11() - codecopy(0, dataoffset(\"C_10_deployed\"), datasize(\"C_10_deployed\")) + codecopy(0, dataoffset(\"C_11_deployed\"), datasize(\"C_11_deployed\")) - return(0, datasize(\"C_10_deployed\")) + return(0, datasize(\"C_11_deployed\")) - function constructor_C_10() { + function constructor_C_11() { } } - object \"C_10_deployed\" { + object \"C_11_deployed\" { code { mstore(64, 128) @@ -36,7 +36,7 @@ object \"C_10\" { // f() if callvalue() { revert(0, 0) } abi_decode_tuple_(4, calldatasize()) - let ret_0 := fun_f_9() + let ret_0 := fun_f_10() let memPos := allocateMemory(0) let memEnd := abi_encode_tuple_t_bytes4__to_t_bytes4__fromStack(memPos , ret_0) return(memPos, sub(memEnd, memPos)) @@ -83,12 +83,12 @@ object \"C_10\" { converted := shift_left_224(cleanup_t_rational_2864434397_by_1(value)) } - function fun_f_9() -> vloc__4 { + function fun_f_10() -> vloc__5 { let zero_value_for_type_t_bytes4_1 := zero_value_for_split_t_bytes4() - vloc__4 := zero_value_for_type_t_bytes4_1 + vloc__5 := zero_value_for_type_t_bytes4_1 - let expr_6 := 0xaabbccdd - vloc__4 := convert_t_rational_2864434397_by_1_to_t_bytes4(expr_6) + let expr_7 := 0xaabbccdd + vloc__5 := convert_t_rational_2864434397_by_1_to_t_bytes4(expr_7) leave } diff --git a/test/cmdlineTests/yul_unimplemented/err b/test/cmdlineTests/yul_unimplemented/err index 1ce8608a6..d1b862ce2 100644 --- a/test/cmdlineTests/yul_unimplemented/err +++ b/test/cmdlineTests/yul_unimplemented/err @@ -1,5 +1,5 @@ Error (1834): Unimplemented feature error in - --> yul_unimplemented/input.sol:5:16: + --> yul_unimplemented/input.sol:6:16: | -5 | return type(test).name; +6 | return type(test).name; | ^^^^^^^^^^^^^^^ diff --git a/test/cmdlineTests/yul_unimplemented/input.sol b/test/cmdlineTests/yul_unimplemented/input.sol index eab2109d8..c9ea15c48 100644 --- a/test/cmdlineTests/yul_unimplemented/input.sol +++ b/test/cmdlineTests/yul_unimplemented/input.sol @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.0; +pragma abicoder v2; contract test { function f() public pure returns (string memory) { return type(test).name;