Report an error if immutables not assigned

This commit is contained in:
a3d4
2020-07-23 16:38:54 +02:00
parent 336fe94422
commit 5b54cfbed3
7 changed files with 48 additions and 8 deletions
+6 -6
View File
@@ -30,6 +30,8 @@
#include <libevmasm/ConstantOptimiser.h>
#include <libevmasm/GasMeter.h>
#include <liblangutil/Exceptions.h>
#include <fstream>
#include <json/json.h>
@@ -699,12 +701,10 @@ LinkerObject const& Assembly::assemble() const
}
}
assertThrow(
immutableReferencesBySub.empty(),
AssemblyException,
"Some immutables were read from but never assigned."
);
if (!immutableReferencesBySub.empty())
throw
langutil::Error(1284_error, langutil::Error::Type::CodeGenerationError) <<
util::errinfo_comment("Some immutables were read from but never assigned, possibly because of optimization.");
if (!m_subs.empty() || !m_data.empty() || !m_auxiliaryData.empty())
// Append an INVALID here to help tests find miscompilation.