From bf074f3f4174f31524d25da816cb4121a21da20c Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 20 Apr 2017 18:44:07 +0100 Subject: Fix source index allocation in CompilerStack. Depending on compiler(optimisations) this could be off-by-one. --- Changelog.md | 5 ++++- libsolidity/interface/CompilerStack.cpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index cd985917..dd62f2df 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,8 +6,11 @@ Features: path(s) of the supplied source file(s) is always trusted. Bugfixes: - * Type system: Contract inheriting from base with unimplemented constructor should be abstract. * Assembly output: Implement missing AssemblyItem types. + * Compiler interface: Fix a bug where source indexes could be inconsistent between Solidity compiled + with different compilers (clang vs. gcc) or compiler settings. The bug was visible in AST + and source mappings. + * Type system: Contract inheriting from base with unimplemented constructor should be abstract. ### 0.4.10 (2017-03-15) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 92b49cda..6ea9ea78 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -406,8 +406,9 @@ vector CompilerStack::sourceNames() const map CompilerStack::sourceIndices() const { map indices; + unsigned index = 0; for (auto const& s: m_sources) - indices[s.first] = indices.size(); + indices[s.first] = index++; return indices; } -- cgit