[RFC] Extension of SIMPLE for Fortran 95
Tim Prince
tprince@computer.org
Mon Jun 10 20:43:00 GMT 2002
On Monday 10 June 2002 02:14, S. Bosscher wrote:
> Hello,
>
> This weekend we discussed the Fortran CYCLE (eqv. of C 'continue') and EXIT
> (eqv. of 'break') statements on the G95 mailing list. In Fortran 95, you
> can have:
>
> OUTER: DO I=...
> ...
> INNER: DO J=...
> ...
> IF (something) THEN
> CYCLE OUTER
> ELSE IF (something else) THEN
> EXIT OUTER
> ENDIF
> ...
> END DO INNER
> ...
>
> END DO OUTER
>
> We want to lower our parse tree to SIMPLE, but we can't represent this kind
> of CYCLE and EXIT statements in SIMPLE.
>
> The back end *does* provide functions for expanding break/continue from
> nested loops (http://cobolforgcc.sourceforge.net/cobol_14.html#SEC138), but
> it seems that only g77 uses these routines to break from an outer loop, or
> to continue a nested loop.
>
> So I would like to propose an extension to the SIMPLE grammar:
> How about adding an integer argument to the 'continue' and 'break'
> statements, that gives how many loops to break or continue from. 'continue'
> without argument would be the "normal" continue statement, 'continue 1'
> would contine the second-innermost loop, etc.
>
> I don't think this change would require a lot of changes in the existing
> code, and it would make SIMPLE a little more language independent. It would
> help G95, too ;-)
>
> Sounds OK?
>
> Greetz
> Steven
I understand the motivation for this, and it should fit in with my automatic
pretty-formatting system, but I have doubts about adding extensions to g77
(or g95) which aren't covered by the Fortran standard.
--
Tim Prince
More information about the Gcc
mailing list