Note that VMS Fortran is not unique in accepting that code.
I have not been able to find a Fortran compiler not accepting
it by default.
GFortran:
C:\Work\Fortran>gfortran soso.for -o soso.exe
C:\Work\Fortran>soso
123 456
C:\Work\Fortran>gfortran bad.for -o bad.exe
C:\Work\Fortran>bad
123 0
C:\Work\Fortran>gfortran -std=f95 soso.for -o soso.exe
soso.for:2:16:
2 | integer*4 a(2)
| 1
Error: GNU Extension: Nonstandard type declaration INTEGER*4 at (1)
soso.for:5:18:
5 | write(*,*) a(1),a(2)
| 1
Error: PROCEDURE attribute conflicts with COMMON attribute in 'a' at (1)
soso.for:9:16:
9 | integer*4 a(2)
| 1
Error: GNU Extension: Nonstandard type declaration INTEGER*4 at (1)
soso.for:11:13:
11 | data a/123,456/
| 1
Error: GNU Extension: initialization of common block variable 'a' in
DATA statement at (1)
C:\Work\Fortran>gfortran -std=f95 bad.for -o bad.exe
bad.for:2:16:
2 | integer*4 a(2)
| 1
Error: GNU Extension: Nonstandard type declaration INTEGER*4 at (1)
bad.for:6:18:
6 | write(*,*) a(1),a(2)
| 1
Error: PROCEDURE attribute conflicts with COMMON attribute in 'a' at (1)
bad.for:10:16:
10 | integer*4 a(2)
| 1
Error: GNU Extension: Nonstandard type declaration INTEGER*4 at (1)
bad.for:12:13:
12 | data a(1)/123/
| 1
Error: GNU Extension: initialization of common block variable 'a' in
DATA statement at (1)
bad.for:16:16:
16 | integer*4 a(2)
| 1
Error: GNU Extension: Nonstandard type declaration INTEGER*4 at (1)
bad.for:18:13:
18 | data a(2)/456/
| 1
Error: GNU Extension: initialization of common block variable 'a' in
DATA statement at (1)
The soso example works fine default.
It is definitely not nice that the compiler and linker silently
drops the initialization of a(2) in the bad example default.
Old G77:
C:\Work\Fortran>g77 soso.for -o soso.exe
C:\Work\Fortran>soso
123 456
C:\Work\Fortran>g77 bad.for -o bad.exe
bad.for: In subroutine `s2':
bad.for:12:
data a(1)/123/
1
bad.for:18: (continued):
data a(2)/456/
2
Common block `m' initialized at (2) already initialized at (1) -- only
one program unit may specify initial values for a particular common block
The soso example works fine default.
I think this way to handle the bad example is rather appropriate.
And an even older Watcom compiler for DOS:
C:\Work\Fortran>wfl soso.for
Open Watcom F77/16 Compile and Link Utility Version 1.9
Portions Copyright (c) 1990-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See
http://www.openwatcom.org/ for details.
wfc soso.for
Open Watcom FORTRAN 77/16 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See
http://www.openwatcom.org/ for details.
soso.for: 11 statements, 53 bytes, 4 extensions, 0 warnings, 0 errors
wlink @__wfl__.lnk
Open Watcom Linker Version 1.9
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See
http://www.openwatcom.org/ for details.
loading object files
searching libraries
creating a DOS executable
C:\Work\Fortran>wfl bad.for
Open Watcom F77/16 Compile and Link Utility Version 1.9
Portions Copyright (c) 1990-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See
http://www.openwatcom.org/ for details.
wfc bad.for
Open Watcom FORTRAN 77/16 Optimizing Compiler Version 1.9
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See
http://www.openwatcom.org/ for details.
bad.for: 17 statements, 59 bytes, 6 extensions, 0 warnings, 0 errors
wlink @__wfl__.lnk
Open Watcom Linker Version 1.9
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See
http://www.openwatcom.org/ for details.
loading object files
searching libraries
creating a DOS executable
(and it produces correct results too for both - I just can't copy paste
from DOSBOX)
Arne