middle-end/8502: [3.2 regression] wrong code generated for switch statement

Richard Henderson rth@redhat.com
Fri Mar 28 04:31:00 GMT 2003


On Tue, Mar 25, 2003 at 02:05:43PM +0100, Volker Reichelt wrote:
> I strongly suspect your patch
> 
>    http://gcc.gnu.org/ml/gcc-cvs/2003-03/msg01201.html
> 
> is responsible for the new failure of this PR because it modifies
> cfgrtl.c where the original failure was fixed.

Blah.  Test case broke again only at -O0.  Fixed thus.


r~

        * cfgrtl.c (try_redirect_by_replacing_jump): Disable removing
        tablejumps with no optimization.

Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.29.2.6.2.2
diff -c -p -d -u -r1.29.2.6.2.2 cfgrtl.c
--- cfgrtl.c	23 Mar 2003 20:41:22 -0000	1.29.2.6.2.2
+++ cfgrtl.c	27 Mar 2003 22:23:00 -0000
@@ -665,7 +665,6 @@ try_redirect_by_replacing_jump (e, targe
   edge tmp;
   rtx set;
   int fallthru = 0;
-  rtx table;
 
   /* Verify that all targets will be TARGET.  */
   for (tmp = src->succ; tmp; tmp = tmp->succ_next)
@@ -675,11 +674,7 @@ try_redirect_by_replacing_jump (e, targe
   if (tmp || !onlyjump_p (insn))
     return false;
 
-  if (flow2_completed && JUMP_LABEL (insn)
-      && (table = NEXT_INSN (JUMP_LABEL (insn))) != NULL_RTX
-      && GET_CODE (table) == JUMP_INSN
-      && (GET_CODE (PATTERN (table)) == ADDR_VEC
-	  || GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC))
+  if ((!optimize || flow2_completed) && tablejump_p (insn))
     return false;
 
   /* Avoid removing branch with side effects.  */



More information about the Gcc-bugs mailing list