[qfcc] Print accurate linenos for more ICEs

This commit is contained in:
Bill Currie 2020-03-14 16:51:54 +09:00
parent 6608c8a1f6
commit 51a30de9c5
3 changed files with 15 additions and 13 deletions

View file

@ -80,7 +80,7 @@ flush_daglabels (void)
else if (op->op_type == op_label) else if (op->op_type == op_label)
op->o.label->daglabel = 0; op->o.label->daglabel = 0;
else else
internal_error (0, "unexpected operand type"); internal_error (op->expr, "unexpected operand type");
} }
daglabel_chain = daglabel_chain->daglabel_chain; daglabel_chain = daglabel_chain->daglabel_chain;
} }
@ -186,7 +186,7 @@ operand_label (dag_t *dag, operand_t *op)
label->op = op; label->op = op;
op->o.label->daglabel = label; op->o.label->daglabel = label;
} else { } else {
internal_error (0, "unexpected operand type: %d", op->op_type); internal_error (op->expr, "unexpected operand type: %d", op->op_type);
} }
return label; return label;
} }
@ -498,7 +498,7 @@ dag_kill_aliases (daglabel_t *l)
def_visit_all (op->o.def, 1, dag_def_kill_aliases_visit, l); def_visit_all (op->o.def, 1, dag_def_kill_aliases_visit, l);
} }
} else { } else {
internal_error (0, "rvalue assignment?"); internal_error (op->expr, "rvalue assignment?");
} }
} }
@ -555,7 +555,8 @@ dagnode_attach_label (dagnode_t *n, daglabel_t *l)
internal_error (0, "attempt to attach operator label to dagnode " internal_error (0, "attempt to attach operator label to dagnode "
"identifiers"); "identifiers");
if (!op_is_identifier (l->op)) if (!op_is_identifier (l->op))
internal_error (0, "attempt to attach non-identifer label to dagnode " internal_error (l->op->expr,
"attempt to attach non-identifer label to dagnode "
"identifiers"); "identifiers");
if (l->dagnode) { if (l->dagnode) {
// if the node is a leaf, then kill its value so no attempt is made // if the node is a leaf, then kill its value so no attempt is made

View file

@ -280,9 +280,9 @@ flowvar_get_def (flowvar_t *var)
case op_temp: case op_temp:
return op->o.tempop.def; return op->o.tempop.def;
case op_alias: case op_alias:
internal_error (0, "unexpected alias operand"); internal_error (op->expr, "unexpected alias operand");
} }
internal_error (0, "oops, blue pill"); internal_error (op->expr, "oops, blue pill");
return 0; return 0;
} }
@ -378,7 +378,7 @@ get_temp_address (function_t *func, operand_t *op)
func->tmpaddr += top->size; func->tmpaddr += top->size;
} }
if (top->o.tempop.offset) { if (top->o.tempop.offset) {
internal_error (0, "real tempop with a non-zero offset"); internal_error (top->expr, "real tempop with a non-zero offset");
} }
op->o.tempop.flowaddr = top->o.tempop.flowaddr + op->o.tempop.offset; op->o.tempop.flowaddr = top->o.tempop.flowaddr + op->o.tempop.offset;
return op->o.tempop.flowaddr; return op->o.tempop.flowaddr;

View file

@ -207,7 +207,7 @@ print_operand (operand_t *op)
case ev_void: case ev_void:
case ev_invalid: case ev_invalid:
case ev_type_count: case ev_type_count:
internal_error (0, "weird value type"); internal_error (op->expr, "weird value type");
} }
break; break;
case op_label: case op_label:
@ -390,7 +390,7 @@ tempop_visit_all (tempop_t *tempop, int overlap,
if (tempop->alias) { if (tempop->alias) {
top = tempop->alias; top = tempop->alias;
if (top->op_type != op_temp) { if (top->op_type != op_temp) {
internal_error (0, "temp alias of non-temp operand"); internal_error (top->expr, "temp alias of non-temp operand");
} }
tempop = &top->o.tempop; tempop = &top->o.tempop;
if ((ret = visit (tempop, data))) if ((ret = visit (tempop, data)))
@ -400,7 +400,7 @@ tempop_visit_all (tempop_t *tempop, int overlap,
} }
for (top = tempop->alias_ops; top; top = top->next) { for (top = tempop->alias_ops; top; top = top->next) {
if (top->op_type != op_temp) { if (top->op_type != op_temp) {
internal_error (0, "temp alias of non-temp operand"); internal_error (top->expr, "temp alias of non-temp operand");
} }
tempop = &top->o.tempop; tempop = &top->o.tempop;
if (tempop == start_tempop) if (tempop == start_tempop)
@ -419,8 +419,9 @@ alias_operand (type_t *type, operand_t *op, expr_t *expr)
operand_t *aop; operand_t *aop;
if (type_size (type) != type_size (op->type)) { if (type_size (type) != type_size (op->type)) {
internal_error (0, "\naliasing operand with type of different size" internal_error (op->expr,
" (%d, %d)", type_size (type), type_size (op->type)); "aliasing operand with type of different size: %d, %d",
type_size (type), type_size (op->type));
} }
aop = new_operand (op_alias, expr); aop = new_operand (op_alias, expr);
aop->o.alias = op; aop->o.alias = op;
@ -554,7 +555,7 @@ statement_get_targetlist (statement_t *s)
target_list[0] = statement_get_target (s); target_list[0] = statement_get_target (s);
} else if (statement_is_jumpb (s)) { } else if (statement_is_jumpb (s)) {
if (table->alias) if (table->alias)
internal_error (0, "aliased jump table"); internal_error (s->opa->expr, "aliased jump table");
e = table->initializer->e.compound.head; //FIXME check!!! e = table->initializer->e.compound.head; //FIXME check!!!
for (i = 0; i < count; e = e->next, i++) for (i = 0; i < count; e = e->next, i++)
target_list[i] = e->expr->e.labelref.label->dest; target_list[i] = e->expr->e.labelref.label->dest;