[tree-ssa][c++ rfc] fix 14089

Richard Henderson rth@redhat.com
Fri Mar 5 23:20:00 GMT 2004


The biggest problem with it is that canonical_type_variant does *not* 
do the right thing for pointer-to-member types at all.  Every time
you invoke that with non-zero quals, you'll get a brand new type node
which is *not* related by TYPE_MAIN_VARIANT with the original.

For reasons that I don't understand at all, we create

	struct {
	  X:: * const a;
	  int b;
	}

instead of

	const struct {
	  X:: * a;
	  int b;
	}

(or something, from memory).  Seems to me the whole pointer-to-member
representational thing inside the compiler is completely borked.

Anyway, for the patch, we've fixed a lot of the other type equality
problems in this area on the branch, so I think we can get away with
removing the canonical_type_variant thing here.  It bootstraps and
compares, anyway.

Ok?


r~


Index: typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.408.2.43
diff -c -p -d -u -r1.408.2.43 typeck.c
--- typeck.c	4 Mar 2004 15:39:33 -0000	1.408.2.43
+++ typeck.c	5 Mar 2004 23:11:53 -0000
@@ -2055,12 +2055,8 @@ build_indirect_ref (tree ptr, const char
       /* [expr.unary.op]
 	 
 	 If the type of the expression is "pointer to T," the type
-	 of  the  result  is  "T."   
-
-         We must use the canonical variant because certain parts of
-	 the back end, like fold, do pointer comparisons between
-	 types.  */
-      tree t = canonical_type_variant (TREE_TYPE (type));
+	 of  the  result  is  "T."  */
+      tree t = TREE_TYPE (type);
 
       if (VOID_TYPE_P (t))
         {



More information about the Gcc-patches mailing list