[RFC PATCH 4/4] fix promotion of struct & union

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

 



---
 linearize.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/linearize.c b/linearize.c
index 485d8eeec..a92a0e095 100644
--- a/linearize.c
+++ b/linearize.c
@@ -957,6 +957,8 @@ static int linearize_address_gen(struct entrypoint *ep,
  */
 static inline int is_promotable(struct symbol *type)
 {
+	struct symbol *member;
+
 	if (type->type == SYM_NODE)
 		type = type->ctype.base_type;
 	switch (type->type) {
@@ -967,7 +969,13 @@ static inline int is_promotable(struct symbol *type)
 		return 1;
 	case SYM_STRUCT:
 	case SYM_UNION:
-		return type->bit_size <= long_ctype.bit_size;
+		if (type->bit_size > long_ctype.bit_size)
+			return 0;
+		FOR_EACH_PTR(type->symbol_list, member) {
+			if (!is_promotable(member))
+				return 0;
+		} END_FOR_EACH_PTR(member);
+		return 1;
 	default:
 		break;
 	}
-- 
2.14.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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