From e9b3dd21d0a391c1abde5531280fc72c6087220e Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 23 Feb 2021 10:45:01 +0100 Subject: [PATCH] Fix bare call wihout returndatacopy. --- libsolidity/codegen/ir/IRGeneratorForStatements.cpp | 13 +++---------- .../functionCall/bare_call_no_returndatacopy.sol | 10 ++++++++++ 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 test/libsolidity/semanticTests/functionCall/bare_call_no_returndatacopy.sol diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index d616dfde8..d22112934 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -2521,9 +2521,7 @@ void IRGeneratorForStatements::appendBareCall( let := (,
, , , , 0, 0) - - let := () - + let := () )"); templ("allocateUnbounded", m_utils.allocateUnboundedFunction()); @@ -2542,13 +2540,8 @@ void IRGeneratorForStatements::appendBareCall( } templ("success", IRVariable(_functionCall).tupleComponent(0).name()); - if (IRVariable(_functionCall).tupleComponent(1).type().category() == Type::Category::InaccessibleDynamic) - templ("returndataVar", ""); - else - { - templ("returndataVar", IRVariable(_functionCall).tupleComponent(1).part("mpos").name()); - templ("extractReturndataFunction", m_utils.extractReturndataFunction()); - } + templ("returndataVar", IRVariable(_functionCall).tupleComponent(1).commaSeparatedList()); + templ("extractReturndataFunction", m_utils.extractReturndataFunction()); templ("address", IRVariable(_functionCall.expression()).part("address").name()); diff --git a/test/libsolidity/semanticTests/functionCall/bare_call_no_returndatacopy.sol b/test/libsolidity/semanticTests/functionCall/bare_call_no_returndatacopy.sol new file mode 100644 index 000000000..e45eeaa4e --- /dev/null +++ b/test/libsolidity/semanticTests/functionCall/bare_call_no_returndatacopy.sol @@ -0,0 +1,10 @@ +contract C { + function f() public returns (bool) { + (bool success, ) = address(1).call(""); + return success; + } +} +// ==== +// compileViaYul: also +// ---- +// f() -> true