aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-11-13 19:12:08 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-11-13 19:18:22 +0800
commitb5e9d849ef93589ab8eb59e1becbc4d7a8250ccb (patch)
tree194fa0e38bd127f84beb15b7d6f667ea665b483c
parent4eaed37b96c219c0486a125fc34c916cdb729026 (diff)
downloaddexon-solidity-b5e9d849ef93589ab8eb59e1becbc4d7a8250ccb.tar
dexon-solidity-b5e9d849ef93589ab8eb59e1becbc4d7a8250ccb.tar.gz
dexon-solidity-b5e9d849ef93589ab8eb59e1becbc4d7a8250ccb.tar.bz2
dexon-solidity-b5e9d849ef93589ab8eb59e1becbc4d7a8250ccb.tar.lz
dexon-solidity-b5e9d849ef93589ab8eb59e1becbc4d7a8250ccb.tar.xz
dexon-solidity-b5e9d849ef93589ab8eb59e1becbc4d7a8250ccb.tar.zst
dexon-solidity-b5e9d849ef93589ab8eb59e1becbc4d7a8250ccb.zip
Ignore unimplemented functions for storage returns.
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/analysis/ControlFlowAnalyzer.cpp7
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol4
-rw-r--r--test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol4
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);
+}