[patch, fortran] PR 40628, front-end optimization pass

Thomas Koenig tkoenig@netcologne.de
Sun Jul 25 19:35:00 GMT 2010


Tobias Burnus wrote:
> Thomas Koenig wrote:
> > Well, here is an updated version of the patch.
> >
> > I have also changed the place where the gfc_run_passes is called to
> > resolve.c, as pault had suggested on IRC.
> >
> > Regression-tested, only allocate_with_typespec.f90 failed (which I also
> > saw on gcc-testresults).
> > OK?
> >   
> OK. Thanks for the patch - and sorry for the late review.

Thanks a lot!

> Nits:
> 
> Index: gfortran.h
> +/* passes.c */
> +
> +void gfc_run_passes (gfc_namespace *);
> 
> 
> Update the filename in the comment.

Done.

> ! { dg-final { scan-tree-dump-times "memmove" 2 "original" } }
> 
> Can you add:
> ! { dg-final { scan-tree-dump-times "string_trim" 0 "original" } }

Done.
> 
>   /* Check for direct comparison between identical variables.
>      TODO: Handle cases with identical refs.  */
>   if (op1->expr_type == EXPR_VARIABLE
>       && op2->expr_type == EXPR_VARIABLE
>       && op1->symtree == op2->symtree
>       && op1->ref == NULL && op2->ref == NULL
>       && op1->ts.type != BT_REAL && op2->ts.type != BT_REAL
>       && op1->ts.type != BT_COMPLEX && op2->ts.type !=BT_COMPLEX)

> Is there a reason that you do not include REAL and COMPLEX variables,
> but everything else? (characters, derived types, polymorphic types
> (class), integer, Hollerith, ...). Especially, as derived types can also
> contains real/complex variables ;-)

The main reason is that I don't want to invalidate the

  if (a /= a)

idiom for checking for NANs.  This would also cause a few testsuite
failures, where we do exactly this.

Again, thanks for the review!

Übertrage Daten ........
Revision 162519 übertragen.

	Thomas



More information about the Fortran mailing list