[J3] END statement
Brad Richardson
everythingfunctional at protonmail.com
Wed Dec 7 14:21:45 UTC 2022
In the majority of instances I would prefer that compilers be strictly
standards conforming by default. In this instance, I think the
interpretation of the code is pretty unambiguous. While I think I agree
with Steve's assessment that it's not strictly in conformance with the
current wording of the standard, I don't really see any technical
reason to want the standard to forbid it. Does anybody know if the
standard was intentionally written to forbid this, and if so why?
Regards,
Brad
On Wed, 2022-12-07 at 09:56 +0200, Ondřej Čertík via J3 wrote:
> Dear committee,
>
> Given this interpretation, the original code:
>
> subroutine sub (); end subroutine; integer i
> end program
>
> Is not conforming.
>
> Some compilers parse this and do not produce any warnings or errors.
>
> What is the committee recommendation on such "syntax extensions", is
> it discouraged to do? Is it better for the Fortran community if all
> compilers try to be as strict as possible regarding these syntax
> rules?
>
> Ondrej
>
> On Wed, Dec 7, 2022, at 3:50 AM, Malcolm Cohen via J3 wrote:
> > Hi Steve,
> >
> > I agree with your analysis.
> >
> > I further note that the “END statement must be the last statement
> > on a
> > line” requirement appears only in this definition. There is no
> > special
> > text in 6.3.3 fixed form which says that you cannot have another
> > statement after the END statement – all 6.3.3 says is that it
> > cannot be
> > continued.
> >
> > However, this is sufficiently subtle that perhaps a NOTE in 6..3.1
> > to
> > the effect of “Because a line can only belong to a single program
> > unit,
> > the program unit END statement cannot be followed by another
> > statement
> > on the same line.”.
> >
> > Vipul writes:
> > > All that 6.3.1 informs me is "integer i" is *not* part of the
> > > program unit 'sub'.
> >
> > No, 6.3.1 says that a program unit is a sequence of lines, and thus
> > it
> > says that it **IS** part of the program unit ‘sub’. And that would
> > have
> > to be invalid syntax.
> >
> > > [it makes] little sense considering the potential scenarios of
> > > machine-generated code
> >
> > If the machine can generate semi-colons, it can generate newlines
> > instead. So I would have to disagree with this contention.
> >
> > Cheers,
> > --
> > ..............Malcolm Cohen, NAG Oxford/Tokyo.
> >
> > *From:* J3 <j3-bounces at mailman.j3-fortran.org> *On Behalf Of *Steve
> > Lionel via J3
> > *Sent:* Wednesday, December 7, 2022 10:02 AM
> > *To:* General J3 interest list <j3 at mailman.j3-fortran.org>
> > *Cc:* Steve Lionel <steve at stevelionel.com>
> > *Subject:* Re: [J3] END statement
> >
> > On 12/6/2022 7:57 PM, Vipul Parekh wrote:
> >
> > > Steve, whatever little English I know does *not* say "to me that
> > > a line can't span more than one program unit" is what is meant by
> > > 6.3.1.
> > That's not how I see it. "A Fortran program unit is a sequence of
> > one
> > or more lines" says to me that a line can't belong to more than one
> > program unit. If the standard had said "one or more statements,
> > comments or include lines" I'd conclude otherwise.
> >
> > I'll be interested in others' views.
> >
> > Steve
More information about the J3
mailing list