Regressions for gcc.c-torture/compile/961203-1.c gcc.dg/20020219-1.c on 64-x-32 with PR32563 sign/sizetype fix

Richard Guenther rguenther@suse.de
Thu Aug 23 15:08:00 GMT 2007


On Thu, 23 Aug 2007, Richard Guenther wrote:

> On Thu, 23 Aug 2007, Richard Guenther wrote:
> 
> > On Thu, 23 Aug 2007, Richard Guenther wrote:
> > 
> > > Index: expr.c
> > > ===================================================================
> > > --- expr.c	(revision 127731)
> > > +++ expr.c	(working copy)
> > > @@ -5915,6 +5915,7 @@ get_inner_reference (tree exp, HOST_WIDE
> > >  				 fold_convert (bitsizetype, offset),
> > >  				 bitsize_unit_node))
> > >        && 0 != (tem = size_binop (PLUS_EXPR, tem, bit_offset))
> > > +      && !TREE_OVERFLOW (tem)
> > >        && host_integerp (tem, 0))
> > >      *pbitpos = tree_low_cst (tem, 0), *poffset = 0;
> > >    else
> > 
> > Unfortunately that regresses with PR32563.
> 
> The following not.  It get's ugly :/

And this is what I will be actually testing.  Can you, too?  (I
verified the ICE on cris is gone at least)

Thanks,
Richard.

2007-08-23  Richard Guenther  <rguenther@suse.de>

	* expr.c (get_inner_reference): Do computation of bitoffset
	from offset in a way we can detect overflow reliably.

Index: expr.c
===================================================================
*** expr.c	(revision 127740)
--- expr.c	(working copy)
*************** get_inner_reference (tree exp, HOST_WIDE
*** 5825,5830 ****
--- 5825,5832 ----
  	*pbitsize = tree_low_cst (size_tree, 1);
      }
  
+   *pmode = mode;
+ 
    /* Compute cumulative bit-offset for nested component-refs and array-refs,
       and find the ultimate containing object.  */
    while (1)
*************** get_inner_reference (tree exp, HOST_WIDE
*** 5909,5926 ****
   done:
  
    /* If OFFSET is constant, see if we can return the whole thing as a
!      constant bit position.  Otherwise, split it up.  */
!   if (host_integerp (offset, 0)
!       && 0 != (tem = size_binop (MULT_EXPR,
! 				 fold_convert (bitsizetype, offset),
! 				 bitsize_unit_node))
!       && 0 != (tem = size_binop (PLUS_EXPR, tem, bit_offset))
!       && host_integerp (tem, 0))
!     *pbitpos = tree_low_cst (tem, 0), *poffset = 0;
!   else
!     *pbitpos = tree_low_cst (bit_offset, 0), *poffset = offset;
  
-   *pmode = mode;
    return exp;
  }
  
--- 5911,5935 ----
   done:
  
    /* If OFFSET is constant, see if we can return the whole thing as a
!      constant bit position.  Make sure to handle overflow during
!      this conversion.  */
!   if (host_integerp (offset, 0))
!     {
!       double_int tem = double_int_mul (tree_to_double_int (offset),
! 				       uhwi_to_double_int (BITS_PER_UNIT));
!       tem = double_int_add (tem, tree_to_double_int (bit_offset));
!       if (double_int_fits_in_shwi_p (tem))
! 	{
! 	  *pbitpos = double_int_to_shwi (tem);
! 	  *poffset = NULL_TREE;
! 	  return exp;
! 	}
!     }
! 
!   /* Otherwise, split it up.  */
!   *pbitpos = tree_low_cst (bit_offset, 0);
!   *poffset = offset;
  
    return exp;
  }
  



More information about the Gcc-patches mailing list