]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/37285 (ICE while building binutils on ppc)
authorRichard Guenther <rguenther@suse.de>
Wed, 1 Oct 2008 15:09:26 +0000 (15:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 1 Oct 2008 15:09:26 +0000 (15:09 +0000)
2008-10-01  Richard Guenther  <rguenther@suse.de>

        PR middle-end/37285
        * tree-vrp.c (execute_vrp): If we optimized away the default
        case make sure to promote the label that got in place of it
        to a default case label.

        * gcc.c-torture/compile/pr37285.c: New testcase.

From-SVN: r140814

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr37285.c [new file with mode: 0644]
gcc/tree-vrp.c

index 8dd8eb5c57e439e89c25e4e670f07d18ded035d3..d20066c4cbb4cf66dce40b44566ab20382fb37be 100644 (file)
@@ -1,3 +1,10 @@
+2008-10-01  Richard Guenther  <rguenther@suse.de>
+
+        PR middle-end/37285
+        * tree-vrp.c (execute_vrp): If we optimized away the default
+        case make sure to promote the label that got in place of it
+        to a default case label.
+
 2008-10-01  Richard Henderson  <rth@redhat.com>
 
        PR tree-opt/35737
index 755a9701033023fdeecb0938cec5a714b74f63e8..16a233a5c7f69fdfea2cc3d74e939c6fb3a9f943 100644 (file)
@@ -1,3 +1,8 @@
+2008-10-01  Richard Guenther  <rguenther@suse.de>
+
+        PR middle-end/37285
+        * gcc.c-torture/compile/pr37285.c: New testcase.
+
 2008-10-01  Kai Tietz  <kai.tietz@onevision.com>
 
        * g++.dg/abi/offsetof.C (main): Use __SIZE_TYPE__ instead of
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37285.c b/gcc/testsuite/gcc.c-torture/compile/pr37285.c
new file mode 100644 (file)
index 0000000..972478b
--- /dev/null
@@ -0,0 +1,15 @@
+_bfd_xcoff_canonicalize_dynamic_reloc (unsigned long long l_symndx)
+{
+  if (l_symndx < 3)
+    {
+      switch (l_symndx)
+      {
+        case 0:
+        case 1:
+         break;
+        case 2:
+         _bfd_abort ("HI");
+    }
+  }
+}
+
index 4f1c3288ce7785fe0196948eaae3935e07335300..949b73c2d0a7e6965d0e13b7267f5bee8b498e4d 100644 (file)
@@ -7149,9 +7149,16 @@ execute_vrp (void)
     {
       size_t j;
       size_t n = TREE_VEC_LENGTH (su->vec);
+      tree label;
       gimple_switch_set_num_labels (su->stmt, n);
       for (j = 0; j < n; j++)
        gimple_switch_set_label (su->stmt, j, TREE_VEC_ELT (su->vec, j));
+      /* As we may have replaced the default label with a regular one
+        make sure to make it a real default label again.  This ensures
+        optimal expansion.  */
+      label = gimple_switch_default_label (su->stmt);
+      CASE_LOW (label) = NULL_TREE;
+      CASE_HIGH (label) = NULL_TREE;
     }
 
   if (VEC_length (edge, to_remove_edges) > 0)