[PATCH 19/20] cast: accept null casts

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

 



Without this, casts to the same non-scalar type would be rejected
and replaced by VOID. Not good.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 linearize.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/linearize.c b/linearize.c
index 1bb46b345..22cf0fdde 100644
--- a/linearize.c
+++ b/linearize.c
@@ -1268,6 +1268,12 @@ static int get_cast_opcode(struct symbol *dst, struct symbol *src)
 		}
 		/* fall through */
 	default:
+		if (src->type == SYM_NODE)
+			src = src->ctype.base_type;
+		if (dst->type == SYM_NODE)
+			dst = dst->ctype.base_type;
+		if (src == dst)
+			return OP_NOP;
 		return OP_BADOP;
 	}
 }
-- 
2.17.1

--
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