[FORTRAN PATCH] Optimize FORALLs with constant mask expressions

Paul Thomas paulthomas2@wanadoo.fr
Fri Feb 9 10:40:00 GMT 2007


FX and Roger,
>
> PS: Roger, since you're working hard on FORALL, I wonder if you are 
> aware of PR30400 ("ANY not accepted as mask in FORALL")?
>
>
This one is a front-end nasty - I have had several stabs at it, but 
cannot simultaneously fix the bug and leave everything else unbroken :-(

The problem lies in primary.c (gfc_match_rvalue), which is detecting 
that ANY is function but is failing to recognise that it is a logical 
intrinsic.  Brutally rubbing its nose in this by forcing this 
recognition fixes the problem.  What is wierd, as noted in the PR, is 
that putting the mask in parentheses clears the problem, in spite of the 
same code being used.

I don't have any of my notes or diffs for this PR - they are all at 
home.  I'll reopen the file next week; maybe a fresh look, after a few 
weeks, will reveal the sticking point.

In principle, I would have said that the FORALLs with constant mask 
expressions could be simplified out in match.c (gfc_match_forall), just 
after the header is matched.  However, it seems to me that the approach 
in this patch is going to add a tiny amount to compilation times and 
will produce the same code.

Best regards

Paul



More information about the Fortran mailing list