aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-09-24 21:49:00 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-10-01 00:44:53 +0200
commit338dd771d713a9725cc70ee62ac5553ad10dcf26 (patch)
treecb572ae1b9c467d80d5fb01875a6a50011b9f0e9
parente5b7d1ecb8425fda8674b1c0b73a118e4aa16560 (diff)
downloadsparse-dev-338dd771d713a9725cc70ee62ac5553ad10dcf26.tar.gz
flex-array: do not lay out invalid struct members
Do not bother trying to lay out invalid struct members, ignore them as it will avoid to special case them later. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--symbol.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/symbol.c b/symbol.c
index 365351a0..4c93a0fb 100644
--- a/symbol.c
+++ b/symbol.c
@@ -121,10 +121,12 @@ static void lay_out_struct(struct symbol *sym, struct struct_union_info *info)
base_size = sym->bit_size;
/*
- * Unsized arrays cause us to not align the resulting
- * structure size
+ * If the member is unsized, either it's a flexible array or
+ * it's invalid and a warning has already been issued.
*/
if (base_size < 0) {
+ if (!is_array_type(sym))
+ return;
info->align_size = 0;
base_size = 0;
}