From e640699d4df6d2731f5fbc094737be85397f7ec5 Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Wed, 26 Apr 2023 20:05:31 -0500 Subject: [PATCH] [solc] CommandLineInterface::assembleYul: ensure unique "" sources. --- solc/CommandLineInterface.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 2e6fc57fc..b1f248642 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -1209,13 +1209,15 @@ void CommandLineInterface::assembleYul(yul::YulStack::Language _language, yul::Y for (auto const& [name, index]: sourceIndices) if (max_index < index) max_index = index; - vector sourceList(max_index + 1, ""); + vector sourceList(max_index + 1); + uint32_t counter{0}; + for (auto& source: sourceList) + source = "unknown-source-" + std::to_string(counter++); for (auto const& [name, index]: sourceIndices) sourceList[index] = name; - assembly->setSourceList(sourceList); sout() << util::jsonPrint( removeNullMembers( - assembly->assemblyJSON() + assembly->assemblyJSON(sourceList) ), m_options.formatting.json ) << endl;