Merge remote-tracking branch 'origin/develop' into breaking

This commit is contained in:
chriseth 2020-12-09 15:24:49 +01:00
commit b18c76e34b
51 changed files with 481 additions and 340 deletions

View File

@ -86,6 +86,7 @@ defaults:
root: build
paths:
- test/tools/ossfuzz/abiv2_proto_ossfuzz
- test/tools/ossfuzz/abiv2_isabelle_ossfuzz
- test/tools/ossfuzz/const_opt_ossfuzz
- test/tools/ossfuzz/solc_noopt_mutator_ossfuzz
- test/tools/ossfuzz/solc_noopt_ossfuzz
@ -830,9 +831,6 @@ jobs:
name: External GnosisSafe tests
command: |
test/externalTests/gnosis.sh /tmp/workspace/soljson.js
# TODO: Re-enable notifications once this is running nightly rather than as a PR check
#- run: *gitter_notify_failure
#- run: *gitter_notify_success
t_ems_compile_ext_gnosis_v2:
docker:
@ -863,9 +861,6 @@ jobs:
name: External GnosisSafe v2 tests
command: |
test/externalTests/gnosis-v2.sh /tmp/workspace/soljson.js
# TODO: Re-enable notifications once this is running nightly rather than as a PR check
#- run: *gitter_notify_failure
#- run: *gitter_notify_success
t_ems_compile_ext_zeppelin:
docker:
@ -895,9 +890,6 @@ jobs:
name: External Zeppelin tests
command: |
test/externalTests/zeppelin.sh /tmp/workspace/soljson.js
# TODO: Re-enable notifications once this is running nightly rather than as a PR check
#- run: *gitter_notify_failure
#- run: *gitter_notify_success
t_ems_compile_ext_colony:
docker:
@ -935,9 +927,8 @@ jobs:
name: External ColonyNetworks tests
command: |
test/externalTests/colony.sh /tmp/workspace/soljson.js
# TODO: Re-enable notifications once this is running nightly rather than as a PR check
#- run: *gitter_notify_failure
#- run: *gitter_notify_success
- run: *gitter_notify_failure
- run: *gitter_notify_success
t_ems_compile_ext_ens:
docker:
@ -977,9 +968,6 @@ jobs:
name: External Ens compilation
command: |
test/externalTests/ens.sh /tmp/workspace/soljson.js
# TODO: Re-enable notifications once this is running nightly rather than as a PR check
#- run: *gitter_notify_failure
#- run: *gitter_notify_success
b_win: &b_win
executor:
@ -1158,7 +1146,7 @@ workflows:
- t_ubu_release_cli: *workflow_ubuntu2004_release
- t_ubu_release_soltest: *workflow_ubuntu2004_release
# Emscripten build and selected tests
# Emscripten build and tests that take 15 minutes or less
- b_ems: *workflow_trigger_on_tags
- t_ems_solcjs: *workflow_emscripten
- t_ems_compile_ext_colony: *workflow_emscripten
@ -1166,7 +1154,6 @@ workflows:
- t_ems_compile_ext_gnosis_v2: *workflow_emscripten
- t_ems_compile_ext_zeppelin: *workflow_emscripten
- t_ems_compile_ext_ens: *workflow_emscripten
- t_ems_test_ext_colony: *workflow_emscripten
# FIXME: Gnosis tests are pretty flaky right now. They often fail on CircleCI due to random ProviderError
# and there are also other less frequent problems. See https://github.com/gnosis/safe-contracts/issues/216.
#- t_ems_test_ext_gnosis: *workflow_emscripten
@ -1226,3 +1213,7 @@ workflows:
- t_ubu_asan_constantinople: *workflow_ubuntu2004_asan
- t_ubu_asan_constantinople_clang: *workflow_ubuntu2004_asan_clang
- t_ubu_asan_cli: *workflow_ubuntu2004_asan
# Emscripten build and tests that take more than 15 minutes to execute
- b_ems: *workflow_trigger_on_tags
- t_ems_test_ext_colony: *workflow_emscripten

View File

@ -94,6 +94,7 @@ struct SourceUnitAnnotation: ASTAnnotation
SetOnce<std::map<ASTString, std::vector<Declaration const*>>> exportedSymbols;
/// Experimental features.
std::set<ExperimentalFeature> experimentalFeatures;
/// Using the new ABI coder. Set to `false` if using ABI coder v1.
SetOnce<bool> useABICoderV2;
};

View File

@ -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);

View File

@ -1,4 +1,22 @@
# This will re-generate the polyfill headers, if any file within libyul/backends/wasm/polyfill/ was modified.
set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/libyul/backends/wasm/polyfill/)
set(POLYFILLS Arithmetic Bitwise Comparison Conversion Interface Keccak Logical Memory)
set(GENERATED_POLYFILL_HEADERS)
foreach(polyfill IN LISTS POLYFILLS)
set(POLYFILL_FILE ${CMAKE_SOURCE_DIR}/libyul/backends/wasm/polyfill/${polyfill}.yul)
file(READ ${POLYFILL_FILE} EWASM_POLYFILL_CONTENT HEX)
string(REGEX MATCHALL ".." EWASM_POLYFILL_CONTENT "${EWASM_POLYFILL_CONTENT}")
string(REGEX REPLACE ";" ",\n\t0x" EWASM_POLYFILL_CONTENT "${EWASM_POLYFILL_CONTENT}")
set(EWASM_POLYFILL_CONTENT "0x${EWASM_POLYFILL_CONTENT}")
set(EWASM_POLYFILL_NAME ${polyfill})
configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/ewasm_polyfill.in" ${CMAKE_BINARY_DIR}/include/ewasmPolyfills/${polyfill}.h @ONLY)
list(APPEND GENERATED_POLYFILL_HEADERS ${CMAKE_BINARY_DIR}/include/ewasmPolyfills/${polyfill}.h)
endforeach()
add_library(yul
${GENERATED_POLYFILL_HEADERS}
AsmAnalysis.cpp
AsmAnalysis.h
AsmAnalysisInfo.h
@ -61,14 +79,6 @@ add_library(yul
backends/wasm/WasmObjectCompiler.h
backends/wasm/WordSizeTransform.cpp
backends/wasm/WordSizeTransform.h
backends/wasm/polyfill/Arithmetic.yul
backends/wasm/polyfill/Bitwise.yul
backends/wasm/polyfill/Comparison.yul
backends/wasm/polyfill/Conversion.yul
backends/wasm/polyfill/Interface.yul
backends/wasm/polyfill/Keccak.yul
backends/wasm/polyfill/Logical.yul
backends/wasm/polyfill/Memory.yul
optimiser/ASTCopier.cpp
optimiser/ASTCopier.h
optimiser/ASTWalker.cpp
@ -187,15 +197,4 @@ add_library(yul
optimiser/VarNameCleaner.h
)
set(POLYFILLS Arithmetic Bitwise Comparison Conversion Interface Keccak Logical Memory)
foreach(polyfill IN LISTS POLYFILLS)
set(POLYFILL_FILE ${CMAKE_SOURCE_DIR}/libyul/backends/wasm/polyfill/${polyfill}.yul)
file(READ ${POLYFILL_FILE} EWASM_POLYFILL_CONTENT HEX)
string(REGEX MATCHALL ".." EWASM_POLYFILL_CONTENT "${EWASM_POLYFILL_CONTENT}")
string(REGEX REPLACE ";" ",\n\t0x" EWASM_POLYFILL_CONTENT "${EWASM_POLYFILL_CONTENT}")
set(EWASM_POLYFILL_CONTENT "0x${EWASM_POLYFILL_CONTENT}")
set(EWASM_POLYFILL_NAME ${polyfill})
configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/ewasm_polyfill.in" ${CMAKE_BINARY_DIR}/include/ewasmPolyfills/${polyfill}.h @ONLY)
endforeach()
target_link_libraries(yul PUBLIC evmasm solutil langutil smtutil)

View File

@ -23,11 +23,11 @@ if [ "$CIRCLECI" ]
then
export TERM="${TERM:-xterm}"
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput setaf 7)"; }
function printError() { echo "$(tput setaf 1)$1$(tput setaf 7)"; }
function printError() { >&2 echo "$(tput setaf 1)$1$(tput setaf 7)"; }
function printLog() { echo "$(tput setaf 3)$1$(tput setaf 7)"; }
else
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput sgr0)"; }
function printError() { echo "$(tput setaf 1)$1$(tput sgr0)"; }
function printError() { >&2 echo "$(tput setaf 1)$1$(tput sgr0)"; }
function printLog() { echo "$(tput setaf 3)$1$(tput sgr0)"; }
fi

View File

@ -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",

View File

@ -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) {

View File

@ -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
}

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0;
pragma abicoder v2;
contract C {
constructor() {}

View File

@ -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)

View File

@ -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();
| ^^^

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0;
pragma abicoder v2;
contract C {}
contract D {

View File

@ -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_15" {
object "D_16" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("D_15_deployed")
codecopy(0, dataoffset("D_15_deployed"), _1)
let _1 := datasize("D_16_deployed")
codecopy(0, dataoffset("D_16_deployed"), _1)
return(0, _1)
}
}
object "D_15_deployed" {
object "D_16_deployed" {
code {
{
mstore(64, 128)
@ -55,10 +55,10 @@ object "D_15" {
{
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)) { panic_error_0x41() }
datacopy(128, dataoffset("C_2"), _2)
datacopy(128, dataoffset("C_3"), _2)
if iszero(create(_1, 128, _2))
{
returndatacopy(_1, _1, returndatasize())
@ -83,17 +83,17 @@ object "D_15" {
revert(0, 0x24)
}
}
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)

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0.0;
pragma abicoder v2;
contract D {
constructor() { assembly {}}

View File

@ -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)

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0.0;
pragma abicoder v2;
contract D {
function f() public pure {

View File

@ -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)

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
pragma abicoder v2;
contract Arraysum {
uint256[] values;

View File

@ -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)

View File

@ -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":

View File

@ -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))
)
)

View File

@ -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":

View File

@ -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":

View File

@ -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_0x41() }
mstore(64, newFreePtr)
}
function fun_f_5()
function fun_f_6()
{ }
function panic_error_0x41()
{

View File

@ -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":

View File

@ -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() {
}

View File

@ -4,7 +4,7 @@
{
"A":
{
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; contract C {} contract D { function f() public { 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":

View File

@ -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_12\" {
object \"D_16\" {
code {
mstore(64, 128)
if callvalue() { revert(0, 0) }
constructor_D_12()
constructor_D_16()
codecopy(0, dataoffset(\"D_12_deployed\"), datasize(\"D_12_deployed\"))
codecopy(0, dataoffset(\"D_16_deployed\"), datasize(\"D_16_deployed\"))
return(0, datasize(\"D_12_deployed\"))
return(0, datasize(\"D_16_deployed\"))
function constructor_D_12() {
function constructor_D_16() {
}
}
object \"D_12_deployed\" {
object \"D_16_deployed\" {
code {
mstore(64, 128)
@ -87,7 +87,7 @@ object \"D_12\" {
// f()
if callvalue() { revert(0, 0) }
abi_decode_tuple_(4, calldatasize())
fun_f_11()
fun_f_15()
let memPos := allocateMemory(0)
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
@ -120,19 +120,20 @@ object \"D_12\" {
memPtr := mload(64)
}
function fun_f_11() {
function fun_f_15() {
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_0x41() }
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_8_address := create(0, _1, sub(_2, _1))
let expr_12_address := create(0, _1, sub(_2, _1))
if iszero(expr_8_address) { revert_forward_1() }
if iszero(expr_12_address) { revert_forward_1() }
releaseTemporaryMemory()
let vloc_c_8_address := expr_12_address
}
@ -165,23 +166,23 @@ object \"D_12\" {
* !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)
@ -212,4 +213,10 @@ object \"D_12\" {
}
"}}},"sources":{"A":{"id":0}}}
"}}},"errors":[{"component":"general","errorCode":"2072","formattedMessage":"Warning: Unused local variable.
--> A:2:93:
|
2 | 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}}}

View File

@ -0,0 +1 @@
--ir --error-codes

View File

@ -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).

View File

@ -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;
}
}

View File

@ -0,0 +1,110 @@
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_0x41() }
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_0x41() {
mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)
mstore(4, 0x41)
revert(0, 0x24)
}
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function zero_value_for_split_t_bool() -> ret {
ret := 0
}
}
}
}

View File

@ -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();
| ^^^

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0;
pragma abicoder v2;
contract C {}
contract D {

View File

@ -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_15" {
object "D_16" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("D_15_deployed")
codecopy(0, dataoffset("D_15_deployed"), _1)
let _1 := datasize("D_16_deployed")
codecopy(0, dataoffset("D_16_deployed"), _1)
return(0, _1)
}
}
object "D_15_deployed" {
object "D_16_deployed" {
code {
{
mstore(64, 128)
@ -67,10 +67,10 @@ object "D_15" {
{
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)) { panic_error_0x41() }
datacopy(128, dataoffset("C_2"), _2)
datacopy(128, dataoffset("C_3"), _2)
if iszero(create(_1, 128, _2))
{
returndatacopy(_1, _1, returndatasize())
@ -95,17 +95,17 @@ object "D_15" {
revert(0, 0x24)
}
}
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)

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
pragma abicoder v2;
contract C
{

View File

@ -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)

View File

@ -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":

View File

@ -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
}

View File

@ -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":

View File

@ -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
}

View File

@ -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":

View File

@ -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
}

View File

@ -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":

View File

@ -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
}

View File

@ -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":

View File

@ -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
}

View File

@ -1,5 +1,5 @@
Error (1834): Unimplemented feature error in <FILENAME REMOVED>
--> yul_unimplemented/input.sol:5:16:
--> yul_unimplemented/input.sol:6:16:
|
5 | return type(test).name;
6 | return type(test).name;
| ^^^^^^^^^^^^^^^

View File

@ -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;

View File

@ -109,22 +109,10 @@ function replace_version_pragmas
find . test -name '*.sol' -type f -print0 | xargs -0 sed -i -E -e 's/pragma solidity [^;]+;/pragma solidity >=0.0;/'
}
function find_truffle_config
function force_truffle_solc_modules
{
local config_file="truffle.js"
local alt_config_file="truffle-config.js"
local soljson="$1"
if [ ! -f "$config_file" ] && [ ! -f "$alt_config_file" ]; then
printError "No matching Truffle config found."
fi
if [ ! -f "$config_file" ]; then
config_file=alt_config_file
fi
echo "$config_file"
}
function force_solc_truffle_modules
{
# Replace solc package by v0.5.0 and then overwrite with current version.
printLog "Forcing solc version for all Truffle modules..."
for d in node_modules node_modules/truffle/node_modules
@ -134,7 +122,7 @@ function force_solc_truffle_modules
cd $d
rm -rf solc
git clone --depth 1 -b master https://github.com/ethereum/solc-js.git solc
cp "$1" solc/soljson.js
cp "$soljson" solc/soljson.js
cd solc
npm install
@ -143,37 +131,25 @@ function force_solc_truffle_modules
done
}
function force_solc
function force_truffle_compiler_settings
{
local config_file="$1"
local dir="$2"
local soljson="$3"
local solc_path="$2"
local level="$3"
local evm_version="$4"
force_solc_truffle_modules "$soljson"
printLog "Forcing solc version..."
cat >> "$config_file" <<EOF
module.exports['compilers'] = {solc: {version: "$dir/solc"} };
EOF
}
function force_solc_settings
{
local config_file="$1"
local settings="$2"
local evmVersion="$3"
printLog "Forcing solc settings..."
printLog "Forcing Truffle compiler settings..."
echo "-------------------------------------"
echo "Config file: $config_file"
echo "Optimizer settings: $settings"
echo "EVM version: $evmVersion"
echo "Compiler path: $solc_path"
echo "Optimization level: $level"
echo "Optimizer settings: $(optimizer_settings_for_level "$level")"
echo "EVM version: $evm_version"
echo "-------------------------------------"
# Forcing the settings should always work by just overwriting the solc object. Forcing them by using a
# dedicated settings objects should only be the fallback.
echo "module.exports['solc'] = { optimizer: $settings, evmVersion: \"$evmVersion\" };" >> "$config_file"
echo "module.exports['compilers']['solc']['settings'] = { optimizer: $settings, evmVersion: \"$evmVersion\" };" >> "$config_file"
echo "module.exports['compilers'] = $(truffle_compiler_settings "$solc_path" "$level" "$evm_version");" >> "$config_file"
}
function verify_compiler_version
@ -196,7 +172,8 @@ function run_install
printLog "Running install function..."
replace_version_pragmas
force_solc "$CONFIG" "$DIR" "$soljson"
force_truffle_solc_modules "$soljson"
force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$OPTIMIZER_LEVEL" istanbul
$init_fn
}
@ -215,6 +192,36 @@ function run_test
$test_fn
}
function optimizer_settings_for_level {
local level="$1"
case "$level" in
1) echo "{enabled: false}" ;;
2) echo "{enabled: true}" ;;
3) echo "{enabled: true, details: {yul: true}}" ;;
*)
printError "Optimizer level not found. Please define OPTIMIZER_LEVEL=[1, 2, 3]"
exit 1
;;
esac
}
function truffle_compiler_settings {
local solc_path="$1"
local level="$2"
local evm_version="$3"
echo "{"
echo " solc: {"
echo " version: \"${solc_path}\","
echo " settings: {"
echo " optimizer: $(optimizer_settings_for_level "$level"),"
echo " evmVersion: \"${evm_version}\""
echo " }"
echo " }"
echo "}"
}
function truffle_run_test
{
local soljson="$1"
@ -222,27 +229,12 @@ function truffle_run_test
local test_fn="$3"
replace_version_pragmas
force_solc "$CONFIG" "$DIR" "$soljson"
force_truffle_solc_modules "$soljson"
printLog "Checking optimizer level..."
if [ -z "$OPTIMIZER_LEVEL" ]; then
printError "Optimizer level not found. Please define OPTIMIZER_LEVEL=[1, 2, 3]"
exit 1
fi
if [[ "$OPTIMIZER_LEVEL" == 1 ]]; then
declare -a optimizer_settings=("{ enabled: false }" "{ enabled: true }" "{ enabled: true, details: { yul: true } }")
fi
if [[ "$OPTIMIZER_LEVEL" == 2 ]]; then
declare -a optimizer_settings=("{ enabled: true }" "{ enabled: true, details: { yul: true } }")
fi
if [[ "$OPTIMIZER_LEVEL" == 3 ]]; then
declare -a optimizer_settings=("{ enabled: true, details: { yul: true } }")
fi
for optimize in "${optimizer_settings[@]}"
for level in $(seq "$OPTIMIZER_LEVEL" 3)
do
clean
force_solc_settings "$CONFIG" "$optimize" "istanbul"
force_truffle_compiler_settings "$CONFIG" "${DIR}/solc" "$level" istanbul
printLog "Running compile function..."
$compile_fn

View File

@ -0,0 +1,10 @@
pragma experimental SMTChecker;
contract C {
function f(bytes calldata x, uint y) external pure {
x[8][0];
x[8][5*y];
}
}
// ----
// Warning 4984: (118-121): CHC: Overflow (resulting value larger than 2**256 - 1) happens here.