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: [PATCH] Fix PR47621


On Tue, 8 Feb 2011, Richard Guenther wrote:

> On Mon, 7 Feb 2011, Ulrich Weigand wrote:
> 
> > Richard Guenther wrote:
> > 
> > > 	PR tree-optimization/47621
> > > 	* tree-ssa.c (non_rewritable_lvalue_p): New function, split out from
> > > 	two duplicates ...
> > > 	(execute_update_addresses_taken): ... here.  Make it more
> > > 	conservative in what we accept.
> > 
> > It seems that this caused PR 45945 to re-appear:
> > 
> > Executing on host: /home/uweigand/fsf/gcc-head-build/gcc/xgcc -B/home/uweigand/fsf/gcc-head-build/gcc/ c_lto_20101009-1_0.o  -O2 -flto -flto-partition=none   -DSTACK_SIZE=16384   -mno-error-reloc        -o gcc-dg-lto-20101009-1-11    (timeout = 900)
> > In file included from :0:0:^M
> > /home/uweigand/fsf/gcc-head/gcc/testsuite/gcc.dg/lto/20101009-1_0.c: In function 'foo':^M
> > /home/uweigand/fsf/gcc-head/gcc/testsuite/gcc.dg/lto/20101009-1_0.c:10:1: error: SSA_NAME_DEF_STMT is wrong^M
> > Expected definition statement:^M
> > __asm__("" : "=r" VIEW_CONVERT_EXPR<unsigned int>(i_3));^M
> > ^M
> > Actual definition statement:^M
> > GIMPLE_NOP^M
> > /home/uweigand/fsf/gcc-head/gcc/testsuite/gcc.dg/lto/20101009-1_0.c:10:1: internal compiler error: verify_ssa failed^M
> 
> I'll have a look.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2011-02-08  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/47641
	* tree-ssa.c (execute_update_addresses_taken): For asm outputs
	require type compatibility.

Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c	(revision 169917)
--- gcc/tree-ssa.c	(working copy)
*************** non_rewritable_lvalue_p (tree lhs)
*** 1898,1904 ****
    /* A decl that is wrapped inside a MEM-REF that covers
       it full is also rewritable.
       ???  The following could be relaxed allowing component
!      references that do not change the access size.  */ ;
    if (TREE_CODE (lhs) == MEM_REF
        && TREE_CODE (TREE_OPERAND (lhs, 0)) == ADDR_EXPR
        && integer_zerop (TREE_OPERAND (lhs, 1)))
--- 1898,1904 ----
    /* A decl that is wrapped inside a MEM-REF that covers
       it full is also rewritable.
       ???  The following could be relaxed allowing component
!      references that do not change the access size.  */
    if (TREE_CODE (lhs) == MEM_REF
        && TREE_CODE (TREE_OPERAND (lhs, 0)) == ADDR_EXPR
        && integer_zerop (TREE_OPERAND (lhs, 1)))
*************** execute_update_addresses_taken (void)
*** 2039,2049 ****
  		{
  		  tree link = gimple_asm_output_op (stmt, i);
  		  tree lhs = TREE_VALUE (link);
! 		  if (TREE_CODE (lhs) != SSA_NAME
! 		      && non_rewritable_lvalue_p (lhs))
  		    {
  		      decl = get_base_address (lhs);
! 		      if (DECL_P (decl))
  			bitmap_set_bit (not_reg_needs, DECL_UID (decl));
  		    }
  		}
--- 2039,2054 ----
  		{
  		  tree link = gimple_asm_output_op (stmt, i);
  		  tree lhs = TREE_VALUE (link);
! 		  if (TREE_CODE (lhs) != SSA_NAME)
  		    {
  		      decl = get_base_address (lhs);
! 		      if (DECL_P (decl)
! 			  && (non_rewritable_lvalue_p (lhs)
! 			      /* We cannot move required conversions from
! 				 the lhs to the rhs in asm statements, so
! 				 require we do not need any.  */
! 			      || !useless_type_conversion_p
! 			            (TREE_TYPE (lhs), TREE_TYPE (decl))))
  			bitmap_set_bit (not_reg_needs, DECL_UID (decl));
  		    }
  		}


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