File tree Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Compiler Features:
1515
1616
1717Bugfixes:
18+ * Yul IR Code Generation: Deterministic order of Yul subobjects.
1819 * SMTChecker: Fix error that reports invalid number of verified checks for BMC and CHC engines.
1920 * SMTChecker: Fix formatting of unary minus expressions in invariants.
2021 * SMTChecker: Fix internal compiler error when reporting proved targets for BMC engine.
Original file line number Diff line number Diff line change @@ -143,7 +143,12 @@ class IRGenerationContext
143143
144144 RevertStrings revertStrings () const { return m_revertStrings; }
145145
146- std::set<ContractDefinition const *, ASTNode::CompareByID>& subObjectsCreated () { return m_subObjects; }
146+ std::vector<ContractDefinition const *> const & subObjectsCreated () { return m_subObjects; }
147+ void addSubObject (ContractDefinition const * _contractDefinition)
148+ {
149+ if (!util::contains (m_subObjects, _contractDefinition))
150+ m_subObjects.emplace_back (_contractDefinition);
151+ }
147152
148153 bool memoryUnsafeInlineAssemblySeen () const { return m_memoryUnsafeInlineAssemblySeen; }
149154 void setMemoryUnsafeInlineAssemblySeen () { m_memoryUnsafeInlineAssemblySeen = true ; }
@@ -195,7 +200,7 @@ class IRGenerationContext
195200 // / It will fail at runtime but the code must still compile.
196201 InternalDispatchMap m_internalDispatchMap;
197202
198- std::set <ContractDefinition const *, ASTNode::CompareByID > m_subObjects;
203+ std::vector <ContractDefinition const *> m_subObjects;
199204
200205 langutil::DebugInfoSelection m_debugInfoSelection = {};
201206 langutil::CharStreamProvider const * m_soliditySourceProvider = nullptr ;
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ std::string IRGenerator::generate(
101101 std::map<ContractDefinition const *, std::string_view const > const & _otherYulSources
102102)
103103{
104- auto subObjectSources = [&_otherYulSources](std::set <ContractDefinition const *, ASTNode::CompareByID > const & subObjects) -> std::string
104+ auto subObjectSources = [&_otherYulSources](std::vector <ContractDefinition const *> const & subObjects) -> std::string
105105 {
106106 std::string subObjectsSources;
107107 for (ContractDefinition const * subObject: subObjects)
Original file line number Diff line number Diff line change @@ -1559,7 +1559,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
15591559
15601560 ContractDefinition const * contract =
15611561 &dynamic_cast <ContractType const &>(*functionType->returnParameterTypes ().front ()).contractDefinition ();
1562- m_context.subObjectsCreated (). insert (contract);
1562+ m_context.addSubObject (contract);
15631563
15641564 Whiskers t (R"( let <memPos> := <allocateUnbounded>()
15651565 let <memEnd> := add(<memPos>, datasize("<object>"))
@@ -1947,7 +1947,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
19471947 auto const & contractType = dynamic_cast <ContractType const &>(*arg);
19481948 solAssert (!contractType.isSuper ());
19491949 ContractDefinition const & contract = contractType.contractDefinition ();
1950- m_context.subObjectsCreated (). insert (&contract);
1950+ m_context.addSubObject (&contract);
19511951 appendCode () << Whiskers (R"(
19521952 let <size> := datasize("<objectName>")
19531953 let <result> := <allocationFunction>(add(<size>, 32))
You can’t perform that action at this time.
0 commit comments