[PATCH] Fix PR59199

Richard Biener rguenther@suse.de
Mon Dec 2 11:06:00 GMT 2013


The following fixes a bug in update_address_taken which fails
to reset debug stmts which take the address of a decl we will
rewrite into SSA form.  Our verifiers don't catch this because
of an early out in the operand scanner which doesn't work in
the specific case of LTO profiledbootstrap (or because we
don't have more specific checking for this case).

Fixed like the following.

LTO profiledbootstrapped on x86_64-unknown-linux-gnu, regular
bootstrap & regtest still running.

Richard.

2013-12-02  Richard Biener  <rguenther@suse.de>

	PR middle-end/59199
	* tree-ssa.c (execute_update_addresses_taken): Reset debug
	stmts that take the address of a no longer addressable decl.

Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c	(revision 205528)
--- gcc/tree-ssa.c	(working copy)
*************** execute_update_addresses_taken (void)
*** 1651,1661 ****
  	      {
  		tree *valuep = gimple_debug_bind_get_value_ptr (stmt);
  		tree decl;
! 		maybe_rewrite_mem_ref_base (valuep, suitable_for_renaming);
! 		decl = non_rewritable_mem_ref_base (*valuep);
  		if (decl
  		    && bitmap_bit_p (suitable_for_renaming, DECL_UID (decl)))
  		  gimple_debug_bind_reset_value (stmt);
  	      }
  
  	    if (gimple_references_memory_p (stmt)
--- 1651,1666 ----
  	      {
  		tree *valuep = gimple_debug_bind_get_value_ptr (stmt);
  		tree decl;
! 		if (TREE_CODE (*valuep) == ADDR_EXPR)
! 		  decl = get_base_address (TREE_OPERAND (*valuep, 0));
! 		else
! 		  decl = non_rewritable_mem_ref_base (*valuep);
  		if (decl
+ 		    && DECL_P (decl)
  		    && bitmap_bit_p (suitable_for_renaming, DECL_UID (decl)))
  		  gimple_debug_bind_reset_value (stmt);
+ 		else
+ 		  maybe_rewrite_mem_ref_base (valuep, suitable_for_renaming);
  	      }
  
  	    if (gimple_references_memory_p (stmt)



More information about the Gcc-patches mailing list