Hi,

The attached is yet another create_pre_exit patch to fix
PR middle-end/49220 which is an ice-on-invalid-code.  It's for
non-void function which returns without value.  The patch is
tested with bootstrap and the top level "make -k check" on
i686-pc-linux-gnu with no new failures and regtested on cross
sh4-unknown-linux-gnu.

Regards,
        kaz
--
2012-11-07  Kaz Kojima  <kkoj...@gcc.gnu.org>

        PR middle-end/49220
        * mode-switching.c (create_pre_exit): Set short_block if there
        are no copy insns.

--- ORIG/trunk/gcc/mode-switching.c     2012-11-06 07:33:20.000000000 +0900
+++ trunk/gcc/mode-switching.c  2012-11-07 07:55:25.000000000 +0900
@@ -322,7 +322,14 @@ create_pre_exit (int n_entities, int *en
                             && GET_CODE (SUBREG_REG (copy_reg)) == REG)
                      copy_start = REGNO (SUBREG_REG (copy_reg));
                    else
-                     break;
+                     {
+                       /* When control reaches end of non-void function,
+                          there are no return copy insns at all.  This
+                          avoids an ice on that invalid function.  */
+                       if (ret_start + nregs == ret_end)
+                         short_block = 1;
+                       break;
+                     }
                    if (copy_start >= FIRST_PSEUDO_REGISTER)
                      break;
                    copy_num

Reply via email to