This is the mail archive of the 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]

Re: [PATCH] improve C++ code by changing fold-const.c

On Jun 2, 2004, at 00:30, Andrew Pinski wrote:

On Jun 2, 2004, at 00:12, Jeffrey A Law wrote:
Basically if the inner & outer types are pointer types (which include
references), then we want to compare what each type points to.  This
(of course) iterates until one or both types are no longer a pointer

Actually it looks like Dale messed up when he changed
tree_ssa_useless_type_conversion_1 to use the language hook and he changed
the checking of the how it considers the pointer types compatible, which
broke this tree_ssa_useless_type_conversion with this respect.
< r1=>

And here is the patch which fixes the mess up by Dale also improves
all of the code I have been looking at too.

OK? Bootstrapped on powerpc-apple-darwin with no regressions.

Andrew Pinski

	* tree-ssa.c: Check the type which the pointer points to
	instead of the pointer types.

Index: tree-ssa.c
RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
retrieving revision 2.3
diff -u -p -r2.3 tree-ssa.c
--- tree-ssa.c	14 May 2004 02:29:23 -0000	2.3
+++ tree-ssa.c	2 Jun 2004 04:32:50 -0000
@@ -555,7 +555,8 @@ tree_ssa_useless_type_conversion_1 (tree
      so strip conversions that just switch between them.  */
   else if (POINTER_TYPE_P (inner_type)
            && POINTER_TYPE_P (outer_type)
-           && lang_hooks.types_compatible_p (inner_type, outer_type))
+           && lang_hooks.types_compatible_p (TREE_TYPE (inner_type),
+					     TREE_TYPE (outer_type)))
     return true;

/* If both the inner and outer types are integral types, then the

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