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]

Compiler crash in cselib_invalidate_regno() patch


Here is a patch which fixes the problem I posted earlier in gcc-bugs.
With this patch, my file compiles correctly - please review for correctness.

Tue Apr 25 19:20:34 PDT 2000  Toshiyasu Morita  (toshi.morita@sega.com)

	* simplify-rtx.c (cselib_invalidate_regno): check if
	unchain_one_elt_list set *l = 0.

*** simplify-rtx.c.bak	Tue Apr 25 18:58:45 2000
--- simplify-rtx.c	Tue Apr 25 19:09:47 2000
***************
*** 2865,2872 ****
  	  /* We have an overlap.  */
  	  unchain_one_elt_list (l);
  
! 	  /* Now, we clear the mapping from value to reg.  It must exist, so
! 	     this code will crash intentionally if it doesn't.  */
  	  for (p = &v->locs; ; p = &(*p)->next)
  	    {
  	      rtx x = (*p)->loc;
--- 2865,2887 ----
  	  /* We have an overlap.  */
  	  unchain_one_elt_list (l);
  
!           /* For an rtx like:
! 
!              (insn 867 865 869 (parallel[ 
!                          (set (reg:SF 24 fr0)
!                              (reg:SF 24 fr0))
!                          (use (reg/v:PSI 48 fpscr))
!                          (clobber (scratch:SI))
!                      ] ) 153 {movsf_ie} (insn_list 865 (nil))
!                  (nil))
! 
!              ... unchain_one_elt_list can set *l = 0 (e.g. v->locs = 0),
!              so we must check for this case here.  */
! 
!           if (!*l)
!              continue;
!           
! 	  /* Now, we clear the mapping from value to reg.  */
  	  for (p = &v->locs; ; p = &(*p)->next)
  	    {
  	      rtx x = (*p)->loc;




Original bug:

> From gcc-bugs-return-14797-tm=netcom.com@gcc.gnu.org Tue Apr 25 19:25:28 2000
> Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
> Precedence: bulk
> List-Unsubscribe: <mailto:gcc-bugs-unsubscribe-tm=netcom.com@gcc.gnu.org>
> List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
> List-Post: <mailto:gcc-bugs@gcc.gnu.org>
> List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
> Sender: gcc-bugs-owner@gcc.gnu.org
> Delivered-To: mailing list gcc-bugs@gcc.gnu.org
> From: Toshiyasu Morita <tm@netcom.com>
> Message-Id: <200004260224.TAA00799@netcom.com>
> Subject: Compiler crash in cselib_invalidate_regno()
> To: gcc-bugs@gcc.gnu.org
> Date: Tue, 25 Apr 2000 19:24:45 -0700 (PDT)
> X-Mailer: ELM [version 2.5 PL3]
> MIME-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> 
> 
> version: gcc CVS 
>    host: i386-linux (RH 6.1)
>  target: sh-elf
> 
> When compiling the file ls_step.i with the options "-O2 -m4-single-only -ml"
> cc1 crashes:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x8180f45 in cselib_invalidate_regno (regno=24, mode=SFmode) at 
> ../../egcs/gcc/simplify-rtx.c:2872
> 
> The code in question looks like:
> 
> /* Now, we clear the mapping from value to reg.  It must exist, so
>    this code will crash intentionally if it doesn't.  */
> for (p = &v->locs; ; p = &(*p)->next)
>   {
>     rtx x = (*p)->loc;
> ...
> 
> (xxgdb) print p
> $1 = (struct elt_loc_list **) 0x825e8d0
> (xxgdb) print *p
> $2 = (struct elt_loc_list *) 0x0
> (xxgdb) 
> 
> So, it looks like there is a bad mapping from value to reg created somewhere?
> 
> BTW, file ls_step.i is included in stress 1.14 at:
> 
> ftp://shell14.ba.best.com/~tm2/stress-1.14.tar.gz
> 
> Toshi
> 
> 


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