[qfcc] Fix segfault when assigning {}

I had intended to check, but forgot.
This commit is contained in:
Bill Currie 2020-03-11 20:45:25 +09:00
parent b6439e8dc1
commit 48a256efaa

View file

@ -293,11 +293,19 @@ assign_expr (expr_t *dst, expr_t *src)
type_t *dst_type, *src_type; type_t *dst_type, *src_type;
convert_name (dst); convert_name (dst);
convert_name (src);
if (dst->type == ex_error) { if (dst->type == ex_error) {
return dst; return dst;
} }
if ((expr = check_valid_lvalue (dst))) {
return expr;
}
dst_type = get_type (dst);
if (!dst_type) {
internal_error (dst, "dst_type broke in assign_expr");
}
if (src) {
convert_name (src);
if (src->type == ex_error) { if (src->type == ex_error) {
return src; return src;
} }
@ -306,15 +314,11 @@ assign_expr (expr_t *dst, expr_t *src)
&& (expr = check_assign_logic_precedence (dst, src))) { && (expr = check_assign_logic_precedence (dst, src))) {
return expr; return expr;
} }
} else {
if (is_scalar (dst_type)) {
if ((expr = check_valid_lvalue (dst))) { return error (dst, "empty scalar initializer");
return expr;
} }
src = new_nil_expr ();
dst_type = get_type (dst);
if (!dst_type) {
internal_error (dst, "dst_type broke in assign_expr");
} }
if (src->type == ex_compound) { if (src->type == ex_compound) {
src = initialized_temp_expr (dst_type, src); src = initialized_temp_expr (dst_type, src);