aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2015-03-03 01:10:32 +0800
committerGav Wood <i@gavwood.com>2015-03-03 18:19:24 +0800
commit226c4a89b2510d69b49513f8863c25d16729adfd (patch)
tree86f394f7a4fa99693a4a4539f0bd972c5231ac43 /ExpressionCompiler.cpp
parenta5b4f18dd7291e403237061d5f9660db0299601d (diff)
downloaddexon-solidity-226c4a89b2510d69b49513f8863c25d16729adfd.tar.gz
dexon-solidity-226c4a89b2510d69b49513f8863c25d16729adfd.tar.zst
dexon-solidity-226c4a89b2510d69b49513f8863c25d16729adfd.zip
Solidity STOPs in case of failed call.
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 430e46b0..63aa8a3c 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -984,9 +984,10 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
m_context << eth::dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
else
// send all gas except for the 21 needed to execute "SUB" and "CALL"
- m_context << u256(21) << eth::Instruction::GAS << eth::Instruction::SUB;
- m_context << eth::Instruction::CALL
- << eth::Instruction::POP; // @todo do not ignore failure indicator
+ m_context << u256(_functionType.valueSet() ? 6741 : 41) << eth::Instruction::GAS << eth::Instruction::SUB;
+ m_context << eth::Instruction::CALL;
+ auto tag = m_context.appendConditionalJump();
+ m_context << eth::Instruction::STOP << tag; // STOP if CALL leaves 0.
if (_functionType.valueSet())
m_context << eth::Instruction::POP;
if (_functionType.gasSet())
@@ -999,10 +1000,12 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
CompilerUtils(m_context).loadFromMemory(0, *firstType, false, true);
}
-void ExpressionCompiler::appendArgumentsCopyToMemory(vector<ASTPointer<Expression const>> const& _arguments,
- TypePointers const& _types,
- bool _padToWordBoundaries,
- bool _padExceptionIfFourBytes)
+void ExpressionCompiler::appendArgumentsCopyToMemory(
+ vector<ASTPointer<Expression const>> const& _arguments,
+ TypePointers const& _types,
+ bool _padToWordBoundaries,
+ bool _padExceptionIfFourBytes
+)
{
solAssert(_types.empty() || _types.size() == _arguments.size(), "");
for (size_t i = 0; i < _arguments.size(); ++i)