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

[Bug debug/44832] [4.6 Regression] -fcompare-debug failure for C++ i386.c



------- Comment #38 from rguenth at gcc dot gnu dot org  2010-07-08 11:45 -------

Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c      (revision 161949)
+++ gcc/tree-vrp.c      (working copy)
@@ -4534,12 +4538,11 @@ compare_case_labels (const void *p1, con
 {
   const_tree const case1 = *(const_tree const*)p1;
   const_tree const case2 = *(const_tree const*)p2;
-  unsigned int uid1 = DECL_UID (CASE_LABEL (case1));
-  unsigned int uid2 = DECL_UID (CASE_LABEL (case2));
+  unsigned int uid1 = LABEL_DECL_UID (CASE_LABEL (case1));
+  unsigned int uid2 = LABEL_DECL_UID (CASE_LABEL (case2));

-  if (uid1 < uid2)
-    return -1;
-  else if (uid1 == uid2)
+  if (uid1 == uid2
+      || uid1 == -1u || uid2 == -1u)
     {
       /* Make sure the default label is first in a group.  */
       if (!CASE_LOW (case1))
@@ -4549,8 +4552,7 @@ compare_case_labels (const void *p1, con
       else
         return tree_int_cst_compare (CASE_LOW (case1), CASE_LOW (case2));
     }
-  else
-    return 1;
+  return uid1 < uid2 ? -1 : 1;
 }

fixes the testcase.


-- 


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


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