From fcb7a2721636a9a2f05659610fc05fa8513f745d Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 2 Mar 2018 17:26:16 +0100 Subject: Only forward returndata if EVM version supports it. --- libsolidity/codegen/CompilerContext.cpp | 2 +- libsolidity/codegen/CompilerContext.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'libsolidity') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 2cd256f3..a35eea73 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -264,7 +264,7 @@ CompilerContext& CompilerContext::appendRevert() CompilerContext& CompilerContext::appendConditionalRevert(bool _forwardReturnData) { - if (_forwardReturnData) + if (_forwardReturnData && m_evmVersion.supportsReturndata()) appendInlineAssembly(R"({ if condition { returndatacopy(0, 0, returndatasize()) diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h index c6f2f3be..098472f7 100644 --- a/libsolidity/codegen/CompilerContext.h +++ b/libsolidity/codegen/CompilerContext.h @@ -158,6 +158,8 @@ public: CompilerContext& appendRevert(); /// Appends a conditional REVERT-call, either forwarding the RETURNDATA or providing the /// empty string. Consumes the condition. + /// If the current EVM version does not support RETURNDATA, uses REVERT but does not forward + /// the data. CompilerContext& appendConditionalRevert(bool _forwardReturnData = false); /// Appends a JUMP to a specific tag CompilerContext& appendJumpTo(eth::AssemblyItem const& _tag) { m_asm->appendJump(_tag); return *this; } -- cgit