This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH] Fix tree-opt/29788, plain CONST_DECL leaking through
- From: Ian Lance Taylor <iant at google dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: 14 Nov 2006 10:14:01 -0800
- Subject: Re: [PATCH] Fix tree-opt/29788, plain CONST_DECL leaking through
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=received:to:cc:subject:references:from:date:in-reply-to: message-id:lines:user-agent:mime-version:content-type; b=pE7E34NQ///weNHUIFDdKwqv1IU5AnfM/11vcLkRLPU2Xtfi1wbKikY6C+L0JSzyR gmBXhlkYVBhA+w0qZxrdA==
- References: <1163431038.2539.61.camel@celery.andrew.com>
Andrew Pinski <pinskia@gmail.com> writes:
> * tree-inline.c (copy_body_r): Call fold after folding indirect
> reference.
>
> * gfortran.fortran-torture/compile/inline_1.f90: New test.
> + *tp = fold (*tp);
I don't understand why this call to fold is needed if
fold_indirect_ref_1 returned a non-NULL value. In that case, it seems
to me that we will have already folded the value.
And in the case where build an INDIRECT_REF, we already know that
folding won't help.
So it seems to me that you should do this:
if (TREE_CODE (new) == ADDR_EXPR)
*tp = fold (TREE_OPERAND (new, 0));
That patch is preapproved if it does what you want and passes
bootstrap and testsuite. Otherwise, please explain why you need to
call fold where you do.
Thanks.
Ian