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

Re: [Bug optimization/13819] New: sh-elf broken; abort in sh_reorg()


On Jan 22, 2004, "tm at kloo dot net" <gcc-bugzilla@gcc.gnu.org> wrote:

> ../../gcc/gcc/libgcc2.c: In function `__fixunsdfdi':
> ../../gcc/gcc/libgcc2.c:1200: internal compiler error: in sh_reorg, at
> config/sh/sh.c:4100

> The SH build invokes this abort:

>                       if (GET_CODE (clobber) != CLOBBER
>                           || ! rtx_equal_p (XEXP (clobber, 0), r0_rtx))
>                         abort ();

That's because the CLOBBER was shared with the insn this was copied
from, and when we adjusted one of them, we broke the other.  This was
introduced by:

2004-01-20  Jan Hubicka  <jh@suse.cz>

	* genemit.c [...]
	(copy_rtx): Do not copy clobbers containing hard regs.

This patch compensates for the change.  I'm checking it in.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR optimization/13819
	* config/sh/sh.c (sh_reorg): Compensate for sharing of CLOBBERs 
	introduced by 2004-01-20's Jan Hubicka's copy_insn change.
	(sh_handle_sp_switch_attribute): Remove warning.

Index: gcc/config/sh/sh.c
===================================================================
RCS file: /cvs/uberbaum/gcc/config/sh/sh.c,v
retrieving revision 1.249
diff -u -p -r1.249 sh.c
--- gcc/config/sh/sh.c 18 Jan 2004 22:37:29 -0000 1.249
+++ gcc/config/sh/sh.c 23 Jan 2004 15:24:07 -0000
@@ -4092,8 +4092,10 @@ sh_reorg (void)
 		  if (GET_CODE (dst) == REG && FP_ANY_REGISTER_P (REGNO (dst)))
 		    {
 		      /* This must be an insn that clobbers r0.  */
-		      rtx clobber = XVECEXP (PATTERN (scan), 0,
-					     XVECLEN (PATTERN (scan), 0) - 1);
+		      rtx *clobberp = &XVECEXP (PATTERN (scan), 0,
+						XVECLEN (PATTERN (scan), 0)
+						- 1);
+		      rtx clobber = *clobberp;
 
 		      if (GET_CODE (clobber) != CLOBBER
 			  || ! rtx_equal_p (XEXP (clobber, 0), r0_rtx))
@@ -4137,7 +4139,8 @@ sh_reorg (void)
 		      last_float_addr = &XEXP (newsrc, 0);
 
 		      /* Remove the clobber of r0.  */
-		      XEXP (clobber, 0) = gen_rtx_SCRATCH (Pmode);
+		      *clobberp = gen_rtx_CLOBBER (GET_MODE (clobber),
+						   gen_rtx_SCRATCH (Pmode));
 		      RTX_UNCHANGING_P (newsrc) = 1;
 		    }
 		  /* This is a mova needing a label.  Create it.  */
@@ -6775,7 +6778,7 @@ sh_handle_sp_switch_attribute (tree *nod
     }
   else
     {
-      char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args)));
+      const char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args)));
       sp_switch = gen_rtx_SYMBOL_REF (VOIDmode, s);
     }
 
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Happy GNU Year!                     oliva@{lsd.ic.unicamp.br, gnu.org}
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist                Professional serial bug killer

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