diff options
author | chriseth <chris@ethereum.org> | 2018-11-13 20:22:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-13 20:22:59 +0800 |
commit | 7e0041cf22a19e109742d36d484bda3b8f0cde40 (patch) | |
tree | 51b27835f04a90aa82c8cee7f3a7f4f34dd4692e | |
parent | 9c6048b0b855d5f3409b1aa7ac47f9f79a0dcde1 (diff) | |
parent | b5e9d849ef93589ab8eb59e1becbc4d7a8250ccb (diff) | |
download | dexon-solidity-7e0041cf22a19e109742d36d484bda3b8f0cde40.tar dexon-solidity-7e0041cf22a19e109742d36d484bda3b8f0cde40.tar.gz dexon-solidity-7e0041cf22a19e109742d36d484bda3b8f0cde40.tar.bz2 dexon-solidity-7e0041cf22a19e109742d36d484bda3b8f0cde40.tar.lz dexon-solidity-7e0041cf22a19e109742d36d484bda3b8f0cde40.tar.xz dexon-solidity-7e0041cf22a19e109742d36d484bda3b8f0cde40.tar.zst dexon-solidity-7e0041cf22a19e109742d36d484bda3b8f0cde40.zip |
Merge pull request #5406 from ethereum/uninitializedStorageUnimplemented
Ignore unimplemented functions for detecting uninitialized storage returns.
4 files changed, 14 insertions, 2 deletions
diff --git a/Changelog.md b/Changelog.md index ff95a89a..2e5a3044 100644 --- a/Changelog.md +++ b/Changelog.md @@ -111,6 +111,7 @@ Bugfixes: * Code Generator: Properly handle negative number literals in ABIEncoderV2. * Code Generator: Do not crash on using a length of zero for multidimensional fixed-size arrays. * Commandline Interface: Correctly handle paths with backslashes on windows. + * Control Flow Analyzer: Ignore unimplemented functions when detecting uninitialized storage pointer returns. * Fix NatSpec json output for `@notice` and `@dev` tags on contract definitions. * Optimizer: Correctly estimate gas costs of constants for special cases. * Optimizer: Fix simplification rule initialization bug that appeared on some emscripten platforms. diff --git a/libsolidity/analysis/ControlFlowAnalyzer.cpp b/libsolidity/analysis/ControlFlowAnalyzer.cpp index ab6569be..8a608552 100644 --- a/libsolidity/analysis/ControlFlowAnalyzer.cpp +++ b/libsolidity/analysis/ControlFlowAnalyzer.cpp @@ -28,8 +28,11 @@ bool ControlFlowAnalyzer::analyze(ASTNode const& _astRoot) bool ControlFlowAnalyzer::visit(FunctionDefinition const& _function) { - auto const& functionFlow = m_cfg.functionFlow(_function); - checkUnassignedStorageReturnValues(_function, functionFlow.entry, functionFlow.exit); + if (_function.isImplemented()) + { + auto const& functionFlow = m_cfg.functionFlow(_function); + checkUnassignedStorageReturnValues(_function, functionFlow.entry, functionFlow.exit); + } return false; } diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol new file mode 100644 index 00000000..8bce0dd2 --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol @@ -0,0 +1,4 @@ +contract C { + function f() internal returns(uint[] storage); + function g() internal returns(uint[] storage s); +} diff --git a/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol b/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol new file mode 100644 index 00000000..818b6a20 --- /dev/null +++ b/test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol @@ -0,0 +1,4 @@ +library L { + function f() public returns(uint[] storage); + function g() public returns(uint[] storage s); +} |