mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[qfcc] Fetch sum operand type early
Because component_sum works in-place, using a[i]'s type after setting c[i] resulting in a null type and thus a segfault.
This commit is contained in:
parent
a46f9a63d2
commit
e888f71f8a
2 changed files with 3 additions and 1 deletions
|
@ -550,6 +550,7 @@ algebra_scope (type_t *type, symtab_t *curscope)
|
|||
algebra_t *
|
||||
algebra_get (const type_t *type)
|
||||
{
|
||||
type = unalias_type (type);
|
||||
if (type->type == ev_invalid) {
|
||||
return type->t.algebra;
|
||||
} else {
|
||||
|
|
|
@ -235,8 +235,9 @@ component_sum (int op, expr_t **c, expr_t **a, expr_t **b,
|
|||
if (get_type (a[i]) != get_type (b[i])) {
|
||||
internal_error (a[i], "tangled multivec types");
|
||||
}
|
||||
auto sum_type = get_type (a[i]);
|
||||
c[i] = new_binary_expr (op, a[i], b[i]);
|
||||
c[i]->e.expr.type = get_type (a[i]);
|
||||
c[i]->e.expr.type = sum_type;
|
||||
c[i] = fold_constants (c[i]);
|
||||
} else if (a[i]) {
|
||||
c[i] = a[i];
|
||||
|
|
Loading…
Reference in a new issue