From d0204eef2fa26c6774835cfe6027f053b85f98ec Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 5 Dec 2018 12:22:18 +0100 Subject: [PATCH] SSAValueTracker should only use nullptr for default values --- libyul/optimiser/SSAValueTracker.cpp | 2 +- libyul/optimiser/SSAValueTracker.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libyul/optimiser/SSAValueTracker.cpp b/libyul/optimiser/SSAValueTracker.cpp index 35b29b042..ef96c3796 100644 --- a/libyul/optimiser/SSAValueTracker.cpp +++ b/libyul/optimiser/SSAValueTracker.cpp @@ -37,7 +37,7 @@ void SSAValueTracker::operator()(VariableDeclaration const& _varDecl) { if (_varDecl.variables.size() == 1) setValue(_varDecl.variables.front().name, _varDecl.value.get()); - else + else if (!_varDecl.value) for (auto const& var: _varDecl.variables) setValue(var.name, nullptr); } diff --git a/libyul/optimiser/SSAValueTracker.h b/libyul/optimiser/SSAValueTracker.h index e182e0133..efec22008 100644 --- a/libyul/optimiser/SSAValueTracker.h +++ b/libyul/optimiser/SSAValueTracker.h @@ -33,6 +33,8 @@ namespace yul * Class that walks the AST and stores the initial value of each variable * that is never assigned to. * + * Default value is represented as nullptr. + * * Prerequisite: Disambiguator */ class SSAValueTracker: public ASTWalker