This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Extension of SIMPLE for Fortran 95
- From: Tim Prince <tprince at computer dot org>
- To: "S. Bosscher" <S dot Bosscher at student dot tudelft dot nl>,"'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Mon, 10 Jun 2002 08:30:06 -0700
- Subject: Re: [RFC] Extension of SIMPLE for Fortran 95
- References: <4195D82C2DB1D211B9910008C7C9B06F01F37285@lr0nt3.lr.tudelft.nl>
- Reply-to: tprince at computer dot org
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