This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] conversion between dissimilar-sized pointers is not useless
- From: DJ Delorie <dj at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 8 Mar 2011 22:44:33 -0500
- Subject: [tree-ssa] conversion between dissimilar-sized pointers is not useless
Affects tpf, mips64, and m32c. Hand-checked tpf by inspection, m32c
tests running now. Look OK so far?
* tree-ssa.c (useless_type_conversion_p): Conversions between
pointers of different modes are not useless.
Index: tree-ssa.c
===================================================================
--- tree-ssa.c (revision 170807)
+++ tree-ssa.c (working copy)
@@ -1227,6 +1227,14 @@
!= TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
return false;
+ /* Some targets support multiple pointer sizes, others support
+ partial-int modes for some pointer types. Do not lose casts
+ between these. */
+ if (TYPE_SIZE (inner_type) != TYPE_SIZE (outer_type)
+ || (GET_MODE_CLASS (TYPE_MODE (inner_type))
+ != GET_MODE_CLASS (TYPE_MODE (outer_type))))
+ return false;
+
/* Do not lose casts to restrict qualified pointers. */
if ((TYPE_RESTRICT (outer_type)
!= TYPE_RESTRICT (inner_type))