]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/42157 (ICE building stage 1 libgcc: SEGV in compare_access_po...
authorMartin Jambor <mjambor@suse.cz>
Thu, 7 Jan 2010 10:38:25 +0000 (11:38 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Thu, 7 Jan 2010 10:38:25 +0000 (11:38 +0100)
2010-01-07  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/42157
* tree-sra.c (compare_access_positions): Stabilize sort if both
accesses have integer types, return zero immediately if they are the
same.

From-SVN: r155689

gcc/ChangeLog
gcc/tree-sra.c

index e8aa64b4127e806ee39d9c03ddd259bf86cea461..62fb30180d74b0d50360cb49ec152f46f626c6e3 100644 (file)
@@ -1,3 +1,10 @@
+2010-01-07  Martin Jambor  <mjambor@suse.cz>
+
+       PR tree-optimization/42157
+       * tree-sra.c (compare_access_positions): Stabilize sort if both
+       accesses have integer types, return zero immediately if they are the
+       same.
+
 2010-01-06  Richard Henderson  <rth@redhat.com>
 
        PR middle-end/41883
index f0e874f2053e3cb99b17bd99a9a2e43088b98f46..ebb40c4aa1ad95938a5a71e7f4f0f2d6b3bcf0b9 100644 (file)
@@ -1110,8 +1110,10 @@ compare_access_positions (const void *a, const void *b)
 
   if (f1->size == f2->size)
     {
+      if (f1->type == f2->type)
+       return 0;
       /* Put any non-aggregate type before any aggregate type.  */
-      if (!is_gimple_reg_type (f1->type)
+      else if (!is_gimple_reg_type (f1->type)
          && is_gimple_reg_type (f2->type))
        return 1;
       else if (is_gimple_reg_type (f1->type)
@@ -1131,7 +1133,7 @@ compare_access_positions (const void *a, const void *b)
       /* 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;
+       return TYPE_PRECISION (f2->type) - TYPE_PRECISION (f1->type);
       /* Put any integral type with non-full precision last.  */
       else if (INTEGRAL_TYPE_P (f1->type)
               && (TREE_INT_CST_LOW (TYPE_SIZE (f1->type))