[J3] [EXTERNAL] Re: END statement

Clune, Thomas L. (GSFC-6101) thomas.l.clune at nasa.gov
Wed Dec 7 14:57:31 UTC 2022


While we are the subject of “wishes outside of the standard itself”:

I wish that all compilers provided means to silence specific warnings _independently_.    Some do this fairly well.    I would really like to write/maintain code that produces a very clean compilation log such that any issues “scream” at me.    Alas, I can usually only manage that for relatively small subsets of my source code, and instead have to search for errors in the stream of warnings.   (Parallel compilation is partly to blame, no doubt.)

A common example is that of unused dummy arguments.   It is great that compilers can warn of them, but there are legitimate reasons to have unused dummy arguments, and I have one particular design pattern that makes it quite common.  I have an “unusable” dummy argument that I use to separate optional arguments and thereby force client code to use keyword association for those options.   And I have an 1-line FPP macro workaround that “uses” such arguments in a manner that should get optimized away.

But lots of other examples are out there.


  *   Tom

From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of j3 <j3 at mailman.j3-fortran.org>
Reply-To: j3 <j3 at mailman.j3-fortran.org>
Date: Wednesday, December 7, 2022 at 9:22 AM
To: j3 <j3 at mailman.j3-fortran.org>
Cc: Brad Richardson <everythingfunctional at protonmail.com>
Subject: [EXTERNAL] Re: [J3] END statement

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<mailto: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<mailto:j3 at mailman.j3-fortran.org>>
> *Cc:* Steve Lionel <steve at stevelionel.com<mailto: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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20221207/70969f25/attachment.htm>


More information about the J3 mailing list