Flexible array members are not allowed in unions. So, warn if one is present. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- symbol.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/symbol.c b/symbol.c index 6633e89de4a9..e578b1a840a3 100644 --- a/symbol.c +++ b/symbol.c @@ -95,6 +95,9 @@ struct struct_union_info { */ static void lay_out_union(struct symbol *sym, struct struct_union_info *info) { + if (sym->bit_size < 0 && is_array_type(sym)) + sparse_error(sym->pos, "flexible array member '%s' in a union", show_ident(sym->ident)); + if (sym->bit_size > info->bit_size) info->bit_size = sym->bit_size; -- 2.28.0