other/8403: ICE in gcc/testsuite/gcc.c-torture/execute/2001012 2-1.c for sh-elf target

Naveen Sharma, Noida naveens@noida.hcltech.com
Wed Dec 18 22:59:00 GMT 2002


Hi,

This fixes PR 8403.

The fix is pretty obvious. 
The function has_hard_reg_initial_val can return a MEM rtx too depending 
on definition of ALLOCATE_INITIAL_VALUE macro. So the patch just checks 
if it is REG before using REGNO macro.

Incidently this also fixes bootstrap error(while building libgcc) 
on mainline for sh-elf cross when rtl checking is enabled.

Tested for sh-elf-target.

Best Regards,
  Naveen Sharma.


Index: gcc/ChangeLog
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.16136
diff -c -2 -p -r1.16136 ChangeLog
*** gcc/ChangeLog	18 Dec 2002 06:36:45 -0000	1.16136
--- gcc/ChangeLog	19 Dec 2002 06:36:34 -0000
***************
*** 1,2 ****
--- 1,7 ----
+ 2002-12-19  Naveen Sharma  <naveens@noida.hcltech.com>
+ 
+ 	* config/sh/sh.c (calc_live_regs): Check return code of
+ 	has_hard_reg_initial_val for REG before using the REGNO macro.
+ 	
  2002-12-17  Jason Merrill  <jason@redhat.com>
  
Index: gcc/config/sh/sh.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.189
diff -c -2 -p -r1.189 sh.c
*** gcc/config/sh/sh.c	16 Dec 2002 18:21:54 -0000	1.189
--- gcc/config/sh/sh.c	19 Dec 2002 06:36:52 -0000
*************** calc_live_regs (count_ptr, live_regs_mas
*** 4421,4426 ****
      {
        rtx pr_initial = has_hard_reg_initial_val (Pmode, PR_REG);
!       pr_live = (pr_initial
! 		 ? REGNO (pr_initial) != (PR_REG) : regs_ever_live[PR_REG]);
      }
    /* Force PR to be live if the prologue has to call the SHmedia
--- 4421,4426 ----
      {
        rtx pr_initial = has_hard_reg_initial_val (Pmode, PR_REG);
!       pr_live = (pr_initial && GET_CODE (pr_initial) == REG)
! 		 ? REGNO (pr_initial) != (PR_REG) : regs_ever_live[PR_REG];
      }
    /* Force PR to be live if the prologue has to call the SHmedia
   



More information about the Gcc-patches mailing list