[Bug middle-end/35800] [4.4 Regression]: Revision 133835 failed to compile binutils

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Apr 2 20:50:00 GMT 2008



------- Comment #10 from rguenth at gcc dot gnu dot org  2008-04-02 20:50 -------
Ah, the following

              /* Index jumptables from zero for suitable values of
                 minval to avoid a subtraction.  */
              if (! optimize_size
                  && compare_tree_int (minval, 0) > 0
                  && compare_tree_int (minval, 3) < 0)
                {
                  minval = build_int_cst (index_type, 0);
                  range = maxval;
                }

relies on the created hole be filled by the default_label - but that is
NULL here.  So, the following looks like the right fix here:

Index: stmt.c
===================================================================
--- stmt.c      (revision 133848)
+++ stmt.c      (working copy)
@@ -2566,11 +2566,15 @@ expand_case (tree exp)
                  = gen_rtx_LABEL_REF (Pmode, label_rtx (n->code_label));
            }

-         /* Fill in the gaps with the default.  */
-         if (default_label)
-           for (i = 0; i < ncases; i++)
-             if (labelvec[i] == 0)
-               labelvec[i] = gen_rtx_LABEL_REF (Pmode, default_label);
+         /* Fill in the gaps with the default.  We may have gaps at
+            the beginning if we tried to avoid the minval subtraction,
+            so substitute some label even if the default label was
+            deemed unreachable.  */
+         if (!default_label)
+           default_label = label_rtx (case_list->code_label);
+         for (i = 0; i < ncases; i++)
+           if (labelvec[i] == 0)
+             labelvec[i] = gen_rtx_LABEL_REF (Pmode, default_label);

          /* Output the table.  */
          emit_label (table_label);


-- 


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



More information about the Gcc-bugs mailing list