From 09535a95caef465cae025d1184167eee43a55e72 Mon Sep 17 00:00:00 2001
From: gatecat <gatecat@ds0.me>
Date: Wed, 17 Feb 2021 15:57:31 +0000
Subject: gowin: Fix IdStrings being overwritten by wireToGlobal

Signed-off-by: gatecat <gatecat@ds0.me>
---
 gowin/arch.cc | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

(limited to 'gowin')

diff --git a/gowin/arch.cc b/gowin/arch.cc
index 58df773c..2e742693 100644
--- a/gowin/arch.cc
+++ b/gowin/arch.cc
@@ -589,14 +589,14 @@ Arch::Arch(ArchArgs args) : args(args)
                 const PairPOD pip = pips[p][j];
                 int destrow = row;
                 int destcol = col;
-                IdString destid(pip.dest_id);
-                IdString gdestname = wireToGlobal(destrow, destcol, db, destid);
+                IdString destid(pip.dest_id), gdestid(pip.dest_id);
+                IdString gdestname = wireToGlobal(destrow, destcol, db, gdestid);
                 if (wires.count(gdestname) == 0)
                     addWire(gdestname, destid, destcol, destrow);
                 int srcrow = row;
                 int srccol = col;
-                IdString srcid(pip.src_id);
-                IdString gsrcname = wireToGlobal(srcrow, srccol, db, srcid);
+                IdString srcid(pip.src_id), gsrcid(pip.src_id);
+                IdString gsrcname = wireToGlobal(srcrow, srccol, db, gsrcid);
                 if (wires.count(gsrcname) == 0)
                     addWire(gsrcname, srcid, srccol, srcrow);
             }
@@ -701,12 +701,12 @@ Arch::Arch(ArchArgs args) : args(args)
                 const PairPOD pip = pips[p][j];
                 int destrow = row;
                 int destcol = col;
-                IdString destid(pip.dest_id);
-                IdString gdestname = wireToGlobal(destrow, destcol, db, destid);
+                IdString destid(pip.dest_id), gdestid(pip.dest_id);
+                IdString gdestname = wireToGlobal(destrow, destcol, db, gdestid);
                 int srcrow = row;
                 int srccol = col;
-                IdString srcid(pip.src_id);
-                IdString gsrcname = wireToGlobal(srcrow, srccol, db, srcid);
+                IdString srcid(pip.src_id), gsrcid(pip.src_id);
+                IdString gsrcname = wireToGlobal(srcrow, srccol, db, gsrcid);
 
                 snprintf(buf, 32, "R%dC%d_%s_%s", row + 1, col + 1, srcid.c_str(this), destid.c_str(this));
                 IdString pipname = id(buf);
-- 
cgit v1.2.3