mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-20 17:31:08 +00:00
Prevent merged if/goto losing its way.
When mering if/goto (ie, if skipping a goto), the rest of the dead code remover is used to delete the goto. That part of the code unuses the goto's label. The if was getting the goto's label without the lable's used count being incremented (the usaged temporarily increases by one). I have no idea why the problem showed up randomly, but this seems to fix it (it fixes /a/ bug, anyway).
This commit is contained in:
parent
953e789db2
commit
56410ddc58
1 changed files with 3 additions and 1 deletions
|
@ -1065,6 +1065,7 @@ remove_label_from_dest (ex_label_t *label)
|
|||
|
||||
debug (0, "dropping deceased label %s", label->name);
|
||||
sblock = label->dest;
|
||||
label->dest = 0;
|
||||
for (l = &sblock->labels; *l; l = &(*l)->next) {
|
||||
if (*l == label) {
|
||||
*l = label->next;
|
||||
|
@ -1232,9 +1233,10 @@ remove_dead_blocks (sblock_t *blocks)
|
|||
s = (statement_t *) sblock->tail;
|
||||
if (is_conditional (s) && is_goto (sb->statements)
|
||||
&& s->opb->o.label->dest == sb->next) {
|
||||
debug (0, "meging if/goto %p %p", sblock, sb);
|
||||
debug (0, "merging if/goto %p %p", sblock, sb);
|
||||
unuse_label (s->opb->o.label);
|
||||
s->opb->o.label = sb->statements->opa->o.label;
|
||||
s->opb->o.label->used++;
|
||||
invert_conditional (s);
|
||||
sb->reachable = 0;
|
||||
for (sb = sb->next; sb; sb = sb->next)
|
||||
|
|
Loading…
Reference in a new issue