Index: abs_net.c =================================================================== --- abs_net.c (revision 10107) +++ abs_net.c (revision 10108) @@ -28,19 +28,15 @@ /* included from abstract.c */ -/* Search netname locally on hlev then search for v/netname in all hlev - parents. Return NULL if not found. */ +/* Search netname for v/netname in all hlev parents. Return NULL if not found. */ csch_anet_t *search_subtree_up(csch_abstract_t *abs, csch_hlevel_t *hlev, const char *netname) { csch_anet_t *net; - net = htsp_get(&hlev->nets, netname); - if (net != NULL) - return net; for(hlev = hlev->parent; hlev != NULL; hlev = hlev->parent) { net = htsp_get(&hlev->nets, netname); - if (net->scope == CSCH_ASCOPE_SUBTREE_LOCAL) + if ((net != NULL) && (net->scope == CSCH_ASCOPE_SUBTREE_LOCAL)) return net; } @@ -68,6 +64,9 @@ case CSCH_ASCOPE_AUTO: /* first search on sheet local and parents for v/ nets */ if (hlev != NULL) { + net = htsp_get(&hlev->nets, netname); + if (net != NULL) + return net; net = search_subtree_up(abs, hlev, netname); if (net != NULL) return net; @@ -81,7 +80,7 @@ sub-sheets are compiled later so they can find this net searching upward */ return htsp_get(&hlev->nets, netname); - case CSCH_ASCOPE_SUBTREE_AUTO: + case CSCH_ASCOPE_SUBTREE_AUTO: /* The ^/ prefix */ if (hlev == NULL) { rnd_message(RND_MSG_ERROR, "Failed to resolve net '%s': scope requires hierarchy which is not available\n", orig_name); return NULL;