RFA: PATCH to tree-nrv for debug/39086 (abort in dwarf with -fno-tree-sra)

Jason Merrill jason@redhat.com
Wed Mar 11 05:01:00 GMT 2009


Richard Guenther wrote:
> +   /* If the front end already did something like this, we might not see all
> +      possible modifications.  In particular, we don't attempt to notice
> +      uses of the address of the RESULT_DECL.  */
> +   if (DECL_NAME (result))
> +     return 0;
> +
> 
> Shouldn't this check for !DECL_ARTIFICIAL or !DECL_IGNORED_P?

DECL_ARTIFICIAL isn't set on the RESULT_DECL.  I thought about checking
DECL_IGNORED_P, but decided that having a name was more pertinent to it
possibly having non-assignment uses.  I could go either way.

> +	  else if (gimple_has_lhs (stmt)
> +		   && gimple_get_lhs (stmt) == result)

Ah, thanks.

> If you change the entry predicate you should be able to remove the last
> hunk.  As of the check for address-taking (you don't seem to fix that), you
> could simply do
> 
>   if (!found
>       || TREE_ADDRESSABLE (found))
>     return 0;
> 
> which should do the trick.

That was just an example of potential issues with doing the backend NRV 
optimization after the front end already did; if we don't do that there 
should be no way for the result to have its address taken.

Here's the patch I'm applying.

Jason

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 39086-2.patch
Type: text/x-patch
Size: 4833 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090311/f76f9240/attachment.bin>


More information about the Gcc-patches mailing list