From: Richard Biener Date: Tue, 14 Jan 2020 09:42:47 +0000 (+0100) Subject: Adjust integer <-> pointer conversion IL checking X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3f969affaf77cc21583941b0e0652c286c433d26;p=gcc.git Adjust integer <-> pointer conversion IL checking The existing check doesn't reflect the actual reason why it exists, the patch makes us to use POINTERS_EXTEND_UNSIGNED instead which is specified for ptr_mode and word_mode/Pmode precision. 2020-05-06 Richard Biener * tree-cfg.c (verify_gimple_assign_unary): Adjust integer to/from pointer conversion checking. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15ac1c3c4df..628008833b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-05-06 Richard Biener + + * tree-cfg.c (verify_gimple_assign_unary): Adjust integer + to/from pointer conversion checking. + 2020-05-05 Michael Meissner * config/rs6000/rs6000-builtin.def: Delete changes meant for a diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index b21ef0eee37..8e6fed876f5 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3591,13 +3591,21 @@ verify_gimple_assign_unary (gassign *stmt) /* Allow conversions from pointer type to integral type only if there is no sign or zero extension involved. For targets were the precision of ptrofftype doesn't match that - of pointers we need to allow arbitrary conversions to ptrofftype. */ + of pointers we allow conversions to types where + POINTERS_EXTEND_UNSIGNED specifies how that works. */ if ((POINTER_TYPE_P (lhs_type) && INTEGRAL_TYPE_P (rhs1_type)) || (POINTER_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (lhs_type) && (TYPE_PRECISION (rhs1_type) >= TYPE_PRECISION (lhs_type) - || ptrofftype_p (lhs_type)))) +#if defined(POINTERS_EXTEND_UNSIGNED) + || (TYPE_MODE (rhs1_type) == ptr_mode + && (TYPE_PRECISION (lhs_type) + == BITS_PER_WORD /* word_mode */ + || (TYPE_PRECISION (lhs_type) + == GET_MODE_PRECISION (Pmode)))) +#endif + ))) return false; /* Allow conversion from integral to offset type and vice versa. */