This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]