BTW: we called that test snippet "Eklund.f" in honor of Dave Eklund who was the 'main man' behind DEC and Intel's Fortran compilers for many, many years (he finally retired a few years back).  Among other things, Dave was always looking for interesting fixed format test cases.   To be fair, when I first tripped over the code snippet around the time Dave was retiring, I sent it to him (and the rest of the Fortran compiler team).  The "HP" Alpha/Itanium compilers (ie. the DEC GEM based ones) were fine with it.   At the time, the Intel compiler accepted the deck without error but tossed cookies in the runtime.  Lori Menard and I filled a bug report and she added it to the Intel Fortran regression test suite.

Here is a version of the same deck that is a tad more intelligible and more likely to be accepted by lessor compiler front-ends:
      PROGRAM BLOCK
      INTEGER I1,I2,I3,I4,I5
      DIMENSION I1(13),I2(13)
      I4=1
      I5=2
      I3=13
      CALL PASCAL(I1,I2,I3,I4,I5)
      END

      SUBROUTINE PASCAL(IP1,IP2,IP3,IP4,IP5)
      INTEGER IP3,IP1(IP3),IP2(IP3),IP4,IP5
      INTEGER IP6,IP7
      DO IP6=IP4,IP3
         DO IP7=IP5,IP6-IP4
            IP1(IP7)=IP2(IP7)+IP2(IP7-IP4)
         ENDDO
         IP1(IP4)=IP4
         IP1(IP6)=IP4
         DO IP7=IP4,IP3-IP6
            WRITE(*,'("  "$)')
         ENDDO
         DO IP7=IP4,IP6
            WRITE(*,'(I4$)') IP1(IP7)
         ENDDO
         WRITE(*,*)
         DO IP7=IP4,IP3
            IP2(IP7)=IP1(IP7)
         ENDDO
      ENDDO
      END


On Wed, Dec 4, 2019 at 9:54 AM Clem Cole <clemc@ccc.com> wrote:
Intel ifort which as one of my friends like to say "has the DEC Fortran compiler DNA ground up and reinserted" ;-)

On Wed, Dec 4, 2019 at 12:41 AM Wesley Parish <wobblygong@gmail.com> wrote:
I've just run that little program through gfortran without switches
(naming it pyramid.for) and it comes up with:

pyramid.for:25:6:

      ;ENDDO;IMPLICIT(IF)=IF;IMPLICIT(EXTERNAL)=IF;DOFORRETURN=IF,GOTO-EX
      1
Error: Bad continuation line at (1)
pyramid.for:12:9:

      R;DOFORIF=INTEGER,INTEGER;ENDDO;INTEGER=IF+IF;GOTO=INTEGER*INTEGER*
         1
Warning: Deleted feature: Loop variable at (1) must be integer
pyramid.for:23:56:

      IF,INTEGER,EXTERNAL,RETURN;DOFOREXTERNAL=IF,GOTO;DOFORRETURN=INTEGE
                                                        1
Warning: Deleted feature: Loop variable at (1) must be integer
pyramid.for:25:52:

      ;ENDDO;IMPLICIT(IF)=IF;IMPLICIT(EXTERNAL)=IF;DOFORRETURN=IF,GOTO-EX
                                                    1
Warning: Deleted feature: Loop variable at (1) must be integer
pyramid.for:26:43:

      XTERNAL;WRITE(IF,'(''$  '')');ENDDO;DOFORRETURN=IF,EXTERNAL;WRITE(I
                                           1
Warning: Deleted feature: Loop variable at (1) must be integer
pyramid.for:27:62:

      IF,'(''$''I4)')IMPLICIT(RETURN);ENDDO;WRITE(IF,'( /)');DOFORRETURN=
                                                              1
Warning: Deleted feature: Loop variable at (1) must be integer
pyramid.for:23:34:

      IF,INTEGER,EXTERNAL,RETURN;DOFOREXTERNAL=IF,GOTO;DOFORRETURN=INTEGE
                                  1
Warning: Deleted feature: Loop variable at (1) must be integer
pyramid.for:15:17:

      LSUBROUTINE(IMPLICIT,LOGICAL,GOTO,IF,INTEGER)
                 1
Warning: Rank mismatch in argument ‘implicit’ at (1) (rank-1 and
scalar) [-Wargument-mismatch]

I think gfortran must have '--strict' on by default. I might try it
with the OpenWatcom Fortran compiler next - if it'll install on my
current Linux box.

Just out of interest, what is your current Fortran 2018 compiler?

Wesley Parish

On 12/4/19, Clem Cole <clemc@ccc.com> wrote:
> On Tue, Dec 3, 2019 at 2:56 AM Dave Horsfall <dave@horsfall.org> wrote:
>
>> As every computer programmer should know, John Backus was emitted in
>> 1924;
>> he
>> gave us the BNF syntax, but the sod also gave us that FORTRAN
>> obscenity...
>>
> Be careful, Fortran still pays a lot of bills (I like to say that it has
> paid my salary for nearly 45 years and I don't program in it - I'm an OS
> guy). But Fortran >>is<< the #1 language for anything scientific and I
> don't think that is going away in the future or really change its position
> in popularity for a number of reasons (my analog is the QWERTY keyboard -
> that ship has sailed and it's not economically interesting). There are a
> number of places to check this out, but try looking at Archer AC Code
> Status
> <http://www.archer.ac.uk/status/codes/>, which is an interesting HPC usage
> site in the UK. Note that Fortran is by far the leading programming
> language used for ‘production’ (there are other sites that offer similar
> data, I'll leave it to the reader to find them).
>
> Trivia: there is no way that FORTRAN can be described in any syntax; it is
>> completely ad-hoc.
>
> Again, be careful with such observations.  First off, I'm fairly sure that
> the Intel Compiler teams (ifort
> <https://software.intel.com/en-us/fortran-compilers>) use a parser
> generator for parts of the ifort front-end. (Paul W might know more details
> as he once worked in that technology).  As I understand it, the front-end
> does have a number of special cases in it, so your observation is partially
> true, but the language definition is not 'completely ad-hoc'.
>
> The facts are that the language my father learned in the early 1960s
> (FORTRAN-II) and the language I learned in the late 60's/early 1970s
> (FORTRAN-IV) are not the same language as today's Fortran-2018, i.e. the
> language definition has hardly been static. Said in another way, about a
> year ago, a new standard for Fortran 2018 standard was released – see
> Fortran
> 2018 (Formerly Fortran 2015)  <https://wg5-fortran.org/f2018.html> and
> it actually
> offers support for ‘modern’ ideas such as object-oriented programming:
> Object-oriented
> programming in Fortran Wiki
> <http://fortranwiki.org/fortran/show/Object-oriented+programming>
> .
>
> FWIW: I tried to explain some of these ideas pictorially in my Quora
> answer: Clem Cole's answer to Is Fortran obsolete?
> <https://www.quora.com/Is-Fortran-obsolete/answer/Clem-Cole> This is not to
> denigrate other languages like Julia, Tensorflow etc. But the fact is that
> the hammer has been improved and the *ways the nails are delivered has
> changed*, but the *fundamental action provided* (fastening for nails and
> scientific computation in the case of Fortran) has been unchanged because
> it has proven to be the one of the best, if not the best to do the job it
> is designed to do.
>
> That said, I offer the following code snippet, which my Intel 2018
> compatible compiler accepts without any switches.  Which is really a
> remarkable comment about the women and men in the front-end team:
>
> C    This FORTRAN program may be compiled and run on a Norsk Data
> C    computer running SINTRAN and the FTN compiler.  It uses only
> C    FORTRAN reserved words, and contains just one numerical
> C    constant, in a character string (a format specifier).  When
> C    you run it, it prints a well known mathematical construct...
> C
> C    Even FORTRAN is a block structured programming language:
> C
>       PROGRAM
>      ;PROGRAM;INTEGERIF,INTEGER,GOTO,IMPLICIT;REALREAL,DIMENSION,EXTERNA
>      AL,FORMAT,END;INTEGERLOGICAL;REALCOMPLEX,DATA,CALL,ASSIGN,CHARACTER
>      R;DOFORIF=INTEGER,INTEGER;ENDDO;INTEGER=IF+IF;GOTO=INTEGER*INTEGER*
>      *INTEGER*INTEGER-INTEGER-IF;CALLFUNCTION(IMPLICIT,REAL,DIMENSION,EX
>      XTERNAL,FORMAT,END,LOGICAL,COMPLEX,DATA,CALL,ASSIGN,CHARACTER);CALL
>      LSUBROUTINE(IMPLICIT,LOGICAL,GOTO,IF,INTEGER)
>       END
>       SUBROUTINEFUNCTIO
>      ON(IMPLICIT,REAL,DIMENSION,EXTERNAL,FORMAT,END,LOGICAL,COMPLEX,DATA
>      A,CALL,ASSIGN,CHARACTER);RETURN
>       END
>       SUBROUTINESUBROUTINE(IMPLICIT,L
>      LOGICAL,GOTO,IF,INTEGER);INTEGERGOTO,IMPLICIT(GOTO),LOGICAL(GOTO),I
>      IF,INTEGER,EXTERNAL,RETURN;DOFOREXTERNAL=IF,GOTO;DOFORRETURN=INTEGE
>      ER,EXTERNAL-IF;IMPLICIT(RETURN)=LOGICAL(RETURN)+LOGICAL(RETURN-IF);
>      ;ENDDO;IMPLICIT(IF)=IF;IMPLICIT(EXTERNAL)=IF;DOFORRETURN=IF,GOTO-EX
>      XTERNAL;WRITE(IF,'(''$  '')');ENDDO;DOFORRETURN=IF,EXTERNAL;WRITE(I
>      IF,'(''$''I4)')IMPLICIT(RETURN);ENDDO;WRITE(IF,'( /)');DOFORRETURN=
>      =IF,GOTO;LOGICAL(RETURN)=IMPLICIT(RETURN);ENDDO;ENDDO
>       END
> Running the program should yield:
>                            1
>                          1   1
>                        1   2   1
>                      1   3   3   1
>                    1   4   6   4   1
>                  1   5  10  10   5   1
>                1   6  15  20  15   6   1
>              1   7  21  35  35  21   7   1
>            1   8  28  56  70  56  28   8   1
>          1   9  36  84 126 126  84  36   9   1
>        1  10  45 120 210 252 210 120  45  10   1
>      1  11  55 165 330 462 462 330 165  55  11   1
>    1  12  66 220 495 792 924 792 495 220  66  12   1
>