diff --git a/releasenotes.md b/releasenotes.md index 6aee5fe62..4023d406e 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -29,6 +29,7 @@ - Fix bug casting bool to int to other int #1995. - `@if` declarations were missing from -P output #1973. - Check exe and lib output so -o works with directories. +- Swizzling an inline vector in a struct would cause a crash. ### Stdlib changes diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index b5eed607d..d63c9a224 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -4978,6 +4978,7 @@ static inline bool sema_expr_analyse_swizzle(SemaContext *context, Expr *expr, E { unsigned vec_len = flat_type->array.len; Type *indexed_type = type_get_indexed_type(parent->type); + assert(indexed_type); if (is_lvalue) check = CHECK_VALUE; ASSERT_SPAN(expr, len > 0); int index; @@ -5241,7 +5242,7 @@ CHECK_DEEPER: if (!swizzle[(int)kw[i]]) goto NOT_SWIZZLE; } // TODO should we do a missing for this as well? - return sema_expr_analyse_swizzle(context, expr, parent, flat_type, kw, len, check, lvalue); + return sema_expr_analyse_swizzle(context, expr, current_parent, flat_type, kw, len, check, lvalue); NOT_SWIZZLE:; } }