Update label destination when moving labels.

This fixes a segfault when optimizing the empty-body test. The label was
getting moved, but the statement block to which it pointed was not updated
and thus it pointed to dead data.
This commit is contained in:
Bill Currie 2016-01-07 21:24:29 +09:00
parent d54ee6c8c3
commit 431074d58f

View file

@ -1308,8 +1308,11 @@ move_labels (sblock_t *dst, sblock_t *src)
if (!src_labels)
return;
while (src_labels->next)
src_labels->dest = dst;
while (src_labels->next) {
src_labels = src_labels->next;
src_labels->dest = dst;
}
src_labels->next = dst->labels;
dst->labels = src->labels;
src->labels = 0;