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]

Re: PR/14899 patch ping^2


Quoting rth from offlist:

> I think you've still got the wrong test. Opaque types should not
> be special for same-type-as. If there are two opaque types, they
> should compare differently wrt same-type, and that's not what you
> have.
>
> Granted, I think there are only two opaque types, and they are
> different sizes, so the earlier check for width prevents stupid
> things from happening, but it does mean that your test is wrong.
> It shouldn't be mentioning opaque types at all.

What about this? (I'm only including the comptypes hunk in the attached patch)

Paolo
diff -u -r1.301 c-typeck.c
--- c-typeck.c  10 Apr 2004 18:47:49 -0000      1.301
+++ c-typeck.c  3 May 2004 07:13:20 -0000
@@ -592,10 +592,14 @@
       break;
 
     case VECTOR_TYPE:
-      /* The target might allow certain vector types to be compatible.  */
-      val = targetm.vector_opaque_p (t1)
-       || targetm.vector_opaque_p (t2)
-       || TYPE_MODE (t1) == TYPE_MODE (t2);
+      /* This is a comparison of types.  Opaque types are identical only if
+         they have the same main variant, which has been caught above (this
+        does not cause troubles the back-end creates them); else check if
+        if the underlying types are identical as well.  */
+      val = !targetm.vector_opaque_p (t1)
+           && !targetm.vector_opaque_p (t2)
+           && TYPE_VECTOR_SUBPARTS (t1) == TYPE_VECTOR_SUBPARTS (t2)
+           && comptypes (TREE_TYPE (t1), TREE_TYPE (t2), 0);
       break;
 
     default:

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