[PATCH] Fix PR59199

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


On Mon, 2 Dec 2013, Jakub Jelinek wrote:

> On Mon, Dec 02, 2013 at 12:05:57PM +0100, Richard Biener wrote:
> > 
> > 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.
> 
> Taking address of a decl that is no longer addressable in debug stmts
> is correct, that is how we generate DW_OP_GNU_implicit_ptr.
> So I think this patch is going to cause huge amount of debug info quality
> regressions.

Does it?  Note the decls in question will be renamed to SSA form,
so not sure what "implicit" pointer you'll build here...?  And
what can you do with that pointer inside the debugger?

If that's desired IL (having both DECL and SSA_NAMEs of that DECL
in the IL) then explicit support for this needs to be added to
the operand scanner.

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)
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer



More information about the Gcc-patches mailing list