------- Comment #7 from jamborm at gcc dot gnu dot org  2009-12-07 14:15 -------
(In reply to comment #6)
> The problem is that the comparison of types is not anti-symmetrical:

Looking at the code, I see that we don't stabilize the sort for
integers.  Can you please try the following (and untested) patch?
Thanks.

Index: mine/gcc/tree-sra.c
===================================================================
--- mine.orig/gcc/tree-sra.c
+++ mine/gcc/tree-sra.c
@@ -1134,10 +1134,17 @@ compare_access_positions (const void *a,
               && TREE_CODE (f2->type) != COMPLEX_TYPE
               && TREE_CODE (f2->type) != VECTOR_TYPE)
        return -1;
-      /* Put the integral type with the bigger precision first.  */
       else if (INTEGRAL_TYPE_P (f1->type)
               && INTEGRAL_TYPE_P (f2->type))
-       return TYPE_PRECISION (f1->type) > TYPE_PRECISION (f2->type) ? -1 : 1;
+       {
+         if (TYPE_PRECISION (f1->type) == TYPE_PRECISION (f2->type))
+           /* Stabilize the sort.  */
+           return TYPE_UID (f1->type) - TYPE_UID (f2->type);
+         else
+           /* Put the integral type with the bigger precision first.  */
+           return TYPE_PRECISION (f1->type) > TYPE_PRECISION (f2->type)
+             ? -1 : 1;
+       }
       /* Put any integral type with non-full precision last.  */
       else if (INTEGRAL_TYPE_P (f1->type)
               && (TREE_INT_CST_LOW (TYPE_SIZE (f1->type))


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42157

Reply via email to