diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-09-24 21:49:00 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-10-01 00:44:53 +0200 |
| commit | 71ddf37a17ea1fd6b8f7044a1fe32ce4e8559ef3 (patch) | |
| tree | e87322622e37de652f20cd023b1d09997200847a | |
| parent | 338dd771d713a9725cc70ee62ac5553ad10dcf26 (diff) | |
| download | sparse-dev-71ddf37a17ea1fd6b8f7044a1fe32ce4e8559ef3.tar.gz | |
flex-array: flexible array members have zero size and alignment is OK
When doing the layout of structures, flexible arrays used to
not align the resulting structure size.
However, the standard specify that while for most purposes
flexible arrays can be handled as if not present, they still
may add some trailing padding (cfr. C11's 6.7.2.1p18).
So, there is no reason to reset the alignment.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | symbol.c | 1 | ||||
| -rw-r--r-- | validation/flex-array-align.c | 1 |
2 files changed, 0 insertions, 2 deletions
@@ -127,7 +127,6 @@ static void lay_out_struct(struct symbol *sym, struct struct_union_info *info) if (base_size < 0) { if (!is_array_type(sym)) return; - info->align_size = 0; base_size = 0; } diff --git a/validation/flex-array-align.c b/validation/flex-array-align.c index 0cc67ab3..9f28942a 100644 --- a/validation/flex-array-align.c +++ b/validation/flex-array-align.c @@ -12,7 +12,6 @@ static int foo(struct s *s) /* * check-name: flex-array-align * check-command: test-linearize -Wno-flexible-array-sizeof $file - * check-known-to-fail * * check-output-ignore * check-output-contains: ret\\..*\\$0x80006 |
