mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support unassigned variables in the SSA value tracker and the data flow analyzer.
This commit is contained in:
@@ -136,17 +136,22 @@ void DataFlowAnalyzer::operator()(Block& _block)
|
||||
|
||||
void DataFlowAnalyzer::handleAssignment(set<YulString> const& _variables, Expression* _value)
|
||||
{
|
||||
static Expression const zero{Literal{{}, LiteralKind::Number, YulString{"0"}, {}}};
|
||||
clearValues(_variables);
|
||||
|
||||
MovableChecker movableChecker;
|
||||
if (_value)
|
||||
movableChecker.visit(*_value);
|
||||
if (_variables.size() == 1)
|
||||
else
|
||||
for (auto const& var: _variables)
|
||||
m_value[var] = &zero;
|
||||
|
||||
if (_value && _variables.size() == 1)
|
||||
{
|
||||
YulString name = *_variables.begin();
|
||||
// Expression has to be movable and cannot contain a reference
|
||||
// to the variable that will be assigned to.
|
||||
if (_value && movableChecker.movable() && !movableChecker.referencedVariables().count(name))
|
||||
if (movableChecker.movable() && !movableChecker.referencedVariables().count(name))
|
||||
m_value[name] = _value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user