This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Fold early
- From: Paul Brook <paul at codesourcery dot com>
- To: "HUANG Chun" <chunhuang73 at hotmail dot com>, fortran at gcc dot gnu dot org,stevenb at suse dot de
- Date: Sun, 11 Jan 2004 23:28:53 +0000
- Subject: Re: Fold early
- Organization: CodeSourcery
- References: <Sea1-F158h1jYhAOylh000415eb@hotmail.com>
On Friday 02 January 2004 8:08 am, HUANG Chun wrote:
> Steven wrote:
> >2003-12-20 Steven Bosscher <stevenb@suse.de>
> >
> > * trans-expr.c (gfc_conv_expr_op): Fold the result expression.
> > * trans.c (gfc_add_modify_expr, gfc_add_expr_to_block): Likewise.
>
> In function gfc_add_expr_to_block, the result expression can not be folded.
> e.g:
>
> i=10
> if(i.le.0) then
> else
> print *,'hello'
> endif
> end
>
> If the result was folded in gfc_add_expr_to_block, the if_block can not be
> done corretly.
Problem is that we're then back to the original problem of not folding
statements properly. The proper fix is complete the if statements before
adding/folding them. This means we have to make gfc_trans_if recursive in
some form, but that's no big deal. See other post for patch.
Paul