This is the mail archive of the gcc@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: tree-ssa-address ICE


Hello,

> On Wednesday 08 June 2005 12:01, Nick Burrett wrote:
> > $ ./cc1 -quiet test.c -mthumb -O2
> > ../../bug.c: In function ?foo?:
> > ../../bug.c:3: internal compiler error: in create_mem_ref, at
> > tree-ssa-address.c:585
> > Please submit a full bug report,
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ;-)
> 
> 
> And some more information in the mean time:
> 
> Starting program: /home/steven/devel/build-test/gcc/cc1 -mthumb t.c -O
>  foo
> 
> Breakpoint 1, fancy_abort (file=0xa19258 "../../mainline/gcc/tree-ssa-address.c", line=585,
>     function=0xa192d3 "create_mem_ref") at diagnostic.c:588
> 588       internal_error ("in %s, at %s:%d", function, trim_filename (file), line);
> (gdb) up
> #1  0x00000000005930da in create_mem_ref (bsi=0x7fbfffd370, type=0x2a95896750, addr=0x7fbfffd390)
>     at tree-ssa-address.c:585
> 585       gcc_unreachable ();
> (gdb) p debug_generic_stmt(bsi.tsi.ptr.stmt)
> #   VUSE <TMT.0D.1208_18>;
> c1D.1197_10 = *s1D.1192_27;
> 
> $12 = void
> (gdb) p parts
> $13 = {symbol = 0x0, base = 0x0, index = 0x2a95981380, step = 0x0, offset = 0x0}

a patch, I will submit it once passes regtesting (only the
tree-ssa-address.c:addr_for_mem_ref part is important, but I have rather
changed also the tree-ssa-loop-ivopts.c parts that could cause similar
problems).

Zdenek

Index: tree-ssa-address.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-address.c,v
retrieving revision 2.1
diff -c -3 -p -r2.1 tree-ssa-address.c
*** tree-ssa-address.c	7 Jun 2005 12:01:28 -0000	2.1
--- tree-ssa-address.c	8 Jun 2005 14:34:35 -0000
*************** addr_for_mem_ref (struct mem_address *ad
*** 198,205 ****
  
  	  templates_initialized = true;
  	  sym = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup ("test_symbol"));
! 	  bse = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
! 	  idx = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER + 1);
  
  	  for (i = 0; i < 32; i++)
  	    gen_addr_rtx ((i & 16 ? sym : NULL_RTX),
--- 198,205 ----
  
  	  templates_initialized = true;
  	  sym = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup ("test_symbol"));
! 	  bse = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
! 	  idx = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 2);
  
  	  for (i = 0; i < 32; i++)
  	    gen_addr_rtx ((i & 16 ? sym : NULL_RTX),
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.78
diff -c -3 -p -r2.78 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c	7 Jun 2005 22:44:56 -0000	2.78
--- tree-ssa-loop-ivopts.c	8 Jun 2005 14:34:35 -0000
*************** add_cost (enum machine_mode mode)
*** 3149,3156 ****
  
    start_sequence ();
    force_operand (gen_rtx_fmt_ee (PLUS, mode,
! 				 gen_raw_REG (mode, FIRST_PSEUDO_REGISTER),
! 				 gen_raw_REG (mode, FIRST_PSEUDO_REGISTER + 1)),
  		 NULL_RTX);
    seq = get_insns ();
    end_sequence ();
--- 3149,3156 ----
  
    start_sequence ();
    force_operand (gen_rtx_fmt_ee (PLUS, mode,
! 				 gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1),
! 				 gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 2)),
  		 NULL_RTX);
    seq = get_insns ();
    end_sequence ();
*************** multiply_by_cost (HOST_WIDE_INT cst, enu
*** 3221,3228 ****
    (*cached)->cst = cst;
  
    start_sequence ();
!   expand_mult (mode, gen_raw_REG (mode, FIRST_PSEUDO_REGISTER), GEN_INT (cst),
! 	       NULL_RTX, 0);
    seq = get_insns ();
    end_sequence ();
    
--- 3221,3228 ----
    (*cached)->cst = cst;
  
    start_sequence ();
!   expand_mult (mode, gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1),
! 	       gen_int_mode (cst, mode), NULL_RTX, 0);
    seq = get_insns ();
    end_sequence ();
    
*************** multiplier_allowed_in_address_p (HOST_WI
*** 3247,3253 ****
    
    if (!valid_mult)
      {
!       rtx reg1 = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
        rtx addr;
        HOST_WIDE_INT i;
  
--- 3247,3253 ----
    
    if (!valid_mult)
      {
!       rtx reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
        rtx addr;
        HOST_WIDE_INT i;
  
*************** get_address_cost (bool symbol_present, b
*** 3305,3316 ****
        HOST_WIDE_INT i;
        initialized = true;
  
!       reg1 = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
  
        addr = gen_rtx_fmt_ee (PLUS, Pmode, reg1, NULL_RTX);
        for (i = 1; i <= 1 << 20; i <<= 1)
  	{
! 	  XEXP (addr, 1) = GEN_INT (i);
  	  if (!memory_address_p (Pmode, addr))
  	    break;
  	}
--- 3305,3316 ----
        HOST_WIDE_INT i;
        initialized = true;
  
!       reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
  
        addr = gen_rtx_fmt_ee (PLUS, Pmode, reg1, NULL_RTX);
        for (i = 1; i <= 1 << 20; i <<= 1)
  	{
! 	  XEXP (addr, 1) = gen_int_mode (i, Pmode);
  	  if (!memory_address_p (Pmode, addr))
  	    break;
  	}
*************** get_address_cost (bool symbol_present, b
*** 3319,3325 ****
  
        for (i = 1; i <= 1 << 20; i <<= 1)
  	{
! 	  XEXP (addr, 1) = GEN_INT (-i);
  	  if (!memory_address_p (Pmode, addr))
  	    break;
  	}
--- 3319,3325 ----
  
        for (i = 1; i <= 1 << 20; i <<= 1)
  	{
! 	  XEXP (addr, 1) = gen_int_mode (-i, Pmode);
  	  if (!memory_address_p (Pmode, addr))
  	    break;
  	}
*************** get_address_cost (bool symbol_present, b
*** 3368,3377 ****
      {
        acost = 0;
        
!       addr = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER);
!       reg1 = gen_raw_REG (Pmode, FIRST_PSEUDO_REGISTER + 1);
        if (ratio_p)
! 	addr = gen_rtx_fmt_ee (MULT, Pmode, addr, GEN_INT (rat));
  
        if (var_present)
  	addr = gen_rtx_fmt_ee (PLUS, Pmode, addr, reg1);
--- 3368,3377 ----
      {
        acost = 0;
        
!       addr = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
!       reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 2);
        if (ratio_p)
! 	addr = gen_rtx_fmt_ee (MULT, Pmode, addr, gen_int_mode (rat, Pmode));
  
        if (var_present)
  	addr = gen_rtx_fmt_ee (PLUS, Pmode, addr, reg1);
*************** get_address_cost (bool symbol_present, b
*** 3383,3392 ****
  	    base = gen_rtx_fmt_e (CONST, Pmode,
  				  gen_rtx_fmt_ee (PLUS, Pmode,
  						  base,
! 						  GEN_INT (off)));
  	}
        else if (offset_p)
! 	base = GEN_INT (off);
        else
  	base = NULL_RTX;
      
--- 3383,3392 ----
  	    base = gen_rtx_fmt_e (CONST, Pmode,
  				  gen_rtx_fmt_ee (PLUS, Pmode,
  						  base,
! 						  gen_int_mode (off, Pmode)));
  	}
        else if (offset_p)
! 	base = gen_int_mode (off, Pmode);
        else
  	base = NULL_RTX;
      


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