From e887c06f6b03b14efb64d93e73f9a94d40e047a2 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 31 Jul 2019 17:37:35 +0200 Subject: [PATCH] FunctionType: Return correct stacksize for transfer/send --- libsolidity/ast/Types.cpp | 2 ++ .../expressions/uncalled_address_transfer_send.sol | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/libsolidity/semanticTests/expressions/uncalled_address_transfer_send.sol diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 65d9abf06..98d3b075b 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -2837,6 +2837,8 @@ unsigned FunctionType::sizeOnStack() const case Kind::ArrayPush: case Kind::ArrayPop: case Kind::ByteArrayPush: + case Kind::Transfer: + case Kind::Send: size = 1; break; default: diff --git a/test/libsolidity/semanticTests/expressions/uncalled_address_transfer_send.sol b/test/libsolidity/semanticTests/expressions/uncalled_address_transfer_send.sol new file mode 100644 index 000000000..0df70f935 --- /dev/null +++ b/test/libsolidity/semanticTests/expressions/uncalled_address_transfer_send.sol @@ -0,0 +1,12 @@ +contract TransferTest { + function() external payable { + // This used to cause an ICE + address(this).transfer; + } + + function f() pure public {} +} +// ==== +// compileViaYul: also +// ---- +// f() ->