[J3] END statement
Vipul Parekh
parekhvs at gmail.com
Mon Dec 5 23:29:42 UTC 2022
Jon,
That three out of 4 processors you tried have a bug whereas the one
(gfortran?) which processed your snippet ok conforms, isn't that what the
standard is informing you?
Re: "These errors occur if the program is compiled as fixed or free form,"
does not the standard only support the semi-colon ';' terminator only with
free-form source and thus you can expect a processor to detect and report
as unsupported with your snippet in fixed-form?
Separately with Intel Fortran, the following appears to process ok:
type t ; end type ; integer i
end program
But not the following:
interface ; subroutine sub() ; end subroutine ; end interface ; integer i
end program
What do you see in the Intel Fortran front-end which makes it reject the
latter? It seems strange the compiler finds something amiss with the
second case here also.
Regards,
Vipul Parekh
On Mon, Dec 5, 2022 at 4:18 PM Steidel, Jon L via J3 <
j3 at mailman.j3-fortran.org> wrote:
> Consider the following two source lines:
>
>
>
> subroutine sub (); end subroutine; integer i
>
> end program
>
>
>
> I have access to four compilers. Two of them error stating that the END
> statement must be the only statement on the line, pointing to the END
> SUBROUTINE statement on line 1. A third errors stating that an END
> statement must be the last statement on the line, also pointing to the END
> SUBROUTINE statement. The fourth silently compiles the program without
> error.
>
>
>
> These errors occur if the program is compiled as fixed or free form.
>
> ,
>
> The only restrictions I find on an END statement are in fixed format.
> 6.3.3.5 Fixed source format, the final two sentences of paragraph 1 state
>
>
>
> The program END statement shall not be continued. A
> statement whose initial line appears to be a program unit END statement
> shall not be continued.
>
>
>
> 6.3.1 Program units, statements, and lines applies to both source formats,
> and says:
>
>
>
> A Fortran program unit is a sequence of one or more lines,
> organized as Fortran statements, comments and INCLUDE lines.
>
> A line is a sequence of zero or more characters. Lines
> following a program unit END statement are not part of that program
>
> unit. A Fortran statement is a sequence of one or more
> complete or partial lines.
>
>
>
> The fixed source form restrictions were in FORTRAN 77. Prior to FORTRAN
> 77 there were only END statements, no ENDIF, and no END SUBROUTINE, END
> FUNCTION, END PROGRAM statements. ENDIF was introduced in F77, the others
> listed in F90. F77 had no statement separators.
>
>
>
> It seems to me the code above should be standard conforming. It surprised
> me that most of the compilers I tried did not accept it. I am curious if
> other compilers accept it, and if I am missing some restriction on END
> statements that would prohibit this code from conforming.
>
>
>
> Regards,
>
>
>
> -jon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20221205/ae43780f/attachment.htm>
More information about the J3
mailing list