diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 7877c3b3e..00ed8e624 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -1014,6 +1014,8 @@ backpatch (ex_list_t *list, expr_t *label) if (!list) return; + if (!label || label->type != ex_label) + internal_error (label, "not a label"); for (i = 0; i < list->size; i++) { e = list->e[i]; @@ -1025,6 +1027,7 @@ backpatch (ex_list_t *list, expr_t *label) else { internal_error (e, 0); } + label->e.label.used++; } } diff --git a/tools/qfcc/source/switch.c b/tools/qfcc/source/switch.c index 28daf8d45..4dec16ff8 100644 --- a/tools/qfcc/source/switch.c +++ b/tools/qfcc/source/switch.c @@ -293,7 +293,7 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val, append_expr (sw, branch); if (tree->left) { - branch = new_binary_expr (IFA, temp, high_label); + branch = branch_expr (IFA, temp, high_label); append_expr (sw, branch); build_switch (sw, tree->left, op, sw_val, temp, default_label); @@ -321,7 +321,7 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val, table = new_symbol_expr (sym); if (tree->left) { - branch = new_binary_expr (IFB, temp, low_label); + branch = branch_expr (IFB, temp, low_label); append_expr (sw, branch); } //FIXME unsigned int