From fca21c8fc0bd4da8636aad94bf052ff47bab3c58 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 5 Apr 2021 14:16:28 -0400 Subject: [PATCH] Corrected an error causing weird and undefined behavior when extracting substrate regions, due to failure to clean up the tagged tiles after exiting a search due to finding a substrate type that was not the global substrate. --- extract/ExtBasic.c | 22 ++-------------------- extract/ExtHier.c | 7 ++++++- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index c5e0b1c3..90d33753 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -1821,26 +1821,8 @@ extOutputDevices(def, transList, outFile) extTransFindSubs(reg->treg_tile, t, tmask, def, &node, NULL); if ((node == NULL) && (TTMaskHasType(tmask, TT_SPACE))) { - /* Device node is possibly the substrate. But: Note */ - /* that TT_SPACE in the mask covers all planes, and it */ - /* is not possible to specify TT_SPACE in a single */ - /* plane. So it is necessary to check for any */ - /* shielding types that block the substrate. */ - - if (!TTMaskIsZero(&ExtCurStyle->exts_globSubstrateShieldTypes)) - { - extTransFindSubs(reg->treg_tile, t, - &ExtCurStyle->exts_globSubstrateShieldTypes, - def, &node, NULL); - } - if ((glob_subsnode == NULL) || (node != NULL)) { - /* See if there is another matching device record */ - /* with a different terminal type, and try again. */ - devptr = extDevFindMatch(devptr, t); - break; - } - else if ((node == NULL) && (glob_subsnode != NULL)) - node = glob_subsnode; + /* Device node is the global substrate. */ + node = glob_subsnode; } else if (node == NULL) { /* See if there is another matching device record */ diff --git a/extract/ExtHier.c b/extract/ExtHier.c index 1426abec..8e51d155 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -127,7 +127,11 @@ extHierSubstrate(ha, use, x, y) /* Find the child's substrate node */ nodeList = extFindNodes(use->cu_def, (Rect *) NULL, TRUE); - if (nodeList == NULL) return; + if (nodeList == NULL) + { + ExtResetTiles(use->cu_def, extUnInit); + return; + } /* Check if the child's substrate node is covered by any substrate */ /* shield type (e.g., deep nwell). This is a stupid-simple check */ @@ -161,6 +165,7 @@ extHierSubstrate(ha, use, x, y) extHierSubShieldFunc, (ClientData)NULL) != 0) { freeMagic(nodeList); + ExtResetTiles(use->cu_def, extUnInit); return; } }