[PATCH 04/13] flex-array: flexible array members have zero size and alignment is OK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 symbol.c                      | 1 -
 validation/flex-array-align.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/symbol.c b/symbol.c
index 4c93a0fb4880..9acffeea7fad 100644
--- a/symbol.c
+++ b/symbol.c
@@ -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 0cc67ab36997..9f28942a1ee1 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
-- 
2.28.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux