From b6319e4d493bbec2650b59a05ed666c34ddf4e58 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 9 Nov 1992 14:30:28 +0000 Subject: [PATCH] Yet another bug: null reference --- lang/m2/comp/casestat.C | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lang/m2/comp/casestat.C b/lang/m2/comp/casestat.C index bb38b686f..8cf73a0c6 100644 --- a/lang/m2/comp/casestat.C +++ b/lang/m2/comp/casestat.C @@ -162,7 +162,7 @@ CaseCode(nd, exitlabel, end_reached) if (val == ce->ce_up) { gen = 0; ce = ce->ce_next; - while (! ce->ce_label) ce = ce->ce_next; + while (ce && ! ce->ce_label) ce = ce->ce_next; } } else if (sh->sh_default) C_rom_ilb(sh->sh_default); @@ -331,14 +331,6 @@ AddOneCase(sh, lnode, rnode, lbl) find the proper place to put ce into the list */ - if (ce->ce_label) { - if (! chk_bounds(sh->sh_lowerbd, ce->ce_low, fund)) { - sh->sh_lowerbd = ce->ce_low; - } - if (! chk_bounds(ce->ce_up, sh->sh_upperbd, fund)) { - sh->sh_upperbd = ce->ce_up; - } - } while (c1 && chk_bounds(c1->ce_low, ce->ce_low, fund)) { c2 = c1; c1 = c1->ce_next; @@ -380,6 +372,14 @@ node_error(rnode, "multiple case entry for value %ld", (long)(ce->ce_up)); c2->ce_next = ce; } + if (ce->ce_label) { + if (! chk_bounds(sh->sh_lowerbd, ce->ce_low, fund)) { + sh->sh_lowerbd = ce->ce_low; + } + if (! chk_bounds(ce->ce_up, sh->sh_upperbd, fund)) { + sh->sh_upperbd = ce->ce_up; + } + } } if (ce->ce_label) sh->sh_nrofentries += ce->ce_up - ce->ce_low + 1; }