This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, fortran] Fix PR 42131, improvement in do loops
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: Richard Henderson <rth at redhat dot com>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 01 Dec 2009 08:18:26 +0100
- Subject: Re: [patch, fortran] Fix PR 42131, improvement in do loops
- References: <1259608967.3212.6.camel@meiner.onlinehome.de> <4B14425B.3090202@redhat.com>
On Mon, 2009-11-30 at 14:08 -0800, Richard Henderson wrote:
> On 11/30/2009 11:22 AM, Thomas Koenig wrote:
> > P.S: Richard, if you have a suggestion along the lines of what
> > you proposed in http://gcc.gnu.org/bugzilla/process_bug.cgi#c22 ,
> > please don't hesitate to say so.
>
> Richi had meant
>
> step_sign = fold_build3 (COND_EXPR, type,
> fold_build2 (LT_EXPR, boolean_type_node, step,
> build_int_cst (type, 0)),
> build_int_cst (type, -1), build_int_cst (type, 1));
>
> I.e. "step_size = (step < 0 ? -1 : 1)".
That would have worked as well, also for folding, I see. I am a bit
surprised because the version with the if didn't work.
If anybody shows that this version is better than what I committed, this
is a trivial enough change that can be done easily.
Thomas