generate CSA for empty case statement
This commit is contained in:
parent
57b1a2757e
commit
808e5d8c7d
1 changed files with 4 additions and 5 deletions
|
@ -73,7 +73,7 @@ compact(nr, low, up)
|
||||||
*/
|
*/
|
||||||
arith diff = up - low;
|
arith diff = up - low;
|
||||||
|
|
||||||
return (nr != 0 && diff >= 0 && diff / nr <= (DENSITY - 1));
|
return (nr == 0 || (diff >= 0 && diff / nr <= (DENSITY - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CaseCode(nd, exitlabel)
|
CaseCode(nd, exitlabel)
|
||||||
|
@ -90,7 +90,6 @@ CaseCode(nd, exitlabel)
|
||||||
register struct case_entry *ce;
|
register struct case_entry *ce;
|
||||||
register arith val;
|
register arith val;
|
||||||
label CaseDescrLab;
|
label CaseDescrLab;
|
||||||
int casecnt = 0;
|
|
||||||
|
|
||||||
assert(pnode->nd_class == Stat && pnode->nd_symb == CASE);
|
assert(pnode->nd_class == Stat && pnode->nd_symb == CASE);
|
||||||
|
|
||||||
|
@ -109,7 +108,6 @@ CaseCode(nd, exitlabel)
|
||||||
/* non-empty case
|
/* non-empty case
|
||||||
*/
|
*/
|
||||||
pnode->nd_lab = ++text_label;
|
pnode->nd_lab = ++text_label;
|
||||||
casecnt++;
|
|
||||||
if (! AddCases(sh, /* to descriptor */
|
if (! AddCases(sh, /* to descriptor */
|
||||||
pnode->nd_left->nd_left,
|
pnode->nd_left->nd_left,
|
||||||
/* of case labels */
|
/* of case labels */
|
||||||
|
@ -130,7 +128,7 @@ CaseCode(nd, exitlabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!casecnt) {
|
if (!sh->sh_nrofentries) {
|
||||||
/* There were no cases, so we have to check the case-expression
|
/* There were no cases, so we have to check the case-expression
|
||||||
here
|
here
|
||||||
*/
|
*/
|
||||||
|
@ -154,7 +152,8 @@ CaseCode(nd, exitlabel)
|
||||||
C_rom_cst(sh->sh_lowerbd);
|
C_rom_cst(sh->sh_lowerbd);
|
||||||
C_rom_cst(sh->sh_upperbd - sh->sh_lowerbd);
|
C_rom_cst(sh->sh_upperbd - sh->sh_lowerbd);
|
||||||
ce = sh->sh_entries;
|
ce = sh->sh_entries;
|
||||||
for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) {
|
if (sh->sh_nrofentries)
|
||||||
|
for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) {
|
||||||
assert(ce);
|
assert(ce);
|
||||||
if (val == ce->ce_value) {
|
if (val == ce->ce_value) {
|
||||||
C_rom_ilb(ce->ce_label);
|
C_rom_ilb(ce->ce_label);
|
||||||
|
|
Loading…
Reference in a new issue