diff options
author | Richard Biener <rguenther@suse.de> | 2020-01-14 10:42:47 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-05-06 08:41:17 +0200 |
commit | 3f969affaf77cc21583941b0e0652c286c433d26 (patch) | |
tree | 5e1e0e0d6e7ed64cea7106cd047802541a809758 /gcc/tree-cfg.c | |
parent | cc80c1e4232a71080e793c7147e0830b88bda937 (diff) | |
download | gcc-3f969affaf77cc21583941b0e0652c286c433d26.zip gcc-3f969affaf77cc21583941b0e0652c286c433d26.tar.gz gcc-3f969affaf77cc21583941b0e0652c286c433d26.tar.bz2 |
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 <rguenther@suse.de>
* tree-cfg.c (verify_gimple_assign_unary): Adjust integer
to/from pointer conversion checking.
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index b21ef0e..8e6fed8 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. */ |