[patch, fortran] Fix PR 42131, improvement in do loops

Thomas Koenig tkoenig@netcologne.de
Tue Dec 1 07:18:00 GMT 2009


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



More information about the Fortran mailing list