1<!--
2Copyright (c) 2018-2019, NVIDIA CORPORATION.  All rights reserved.
3-->
4
5As a general principle, this compiler will accept by default and
6without complaint many legacy features, extensions to the standard
7language, and features that have been deleted from the standard,
8so long as the recognition of those features would not cause a
9standard-conforming program to be rejected or misinterpreted.
10
11Other non-standard features, which do conflict with the current
12standard specification of the Fortran programming language, are
13accepted if enabled by command-line options.
14
15Intentional violations of the standard
16======================================
17* The default `INTEGER` type is required by the standard to occupy
18  the same amount of storage as the default `REAL` type.  Default
19  `REAL` is of course 32-bit IEEE-754 floating-point today.  This legacy
20  rule imposes an artificially small constraint in some cases
21  where Fortran mandates that something have the default `INTEGER`
22  type: specifically, the results of references to the intrinsic functions
23  `LEN`, `SIZE`, `LBOUND`, `UBOUND`, and `SHAPE`.  We return
24  `INTEGER(KIND=8)` in these cases.
25
26Extensions, deletions, and legacy features supported by default
27===============================================================
28* Tabs in source
29* `<>` as synonym for `.NE.` and `/=`
30* `$` and `@` as legal characters in names
31* Initialization in type declaration statements using `/values/`
32* Kind specification with `*`, e.g. `REAL*4`
33* `DOUBLE COMPLEX`
34* Signed complex literal constants
35* DEC `STRUCTURE`, `RECORD`, `UNION`, and `MAP`
36* Structure field access with `.field`
37* `BYTE` as synonym for `INTEGER(KIND=1)`
38* Quad precision REAL literals with `Q`
39* `X` prefix/suffix as synonym for `Z` on hexadecimal literals
40* `B`, `O`, `Z`, and `X` accepted as suffixes as well as prefixes
41* Triplets allowed in array constructors
42* Old-style `PARAMETER pi=3.14` statement without parentheses
43* `%LOC`, `%VAL`, and `%REF`
44* Leading comma allowed before I/O item list
45* Empty parentheses allowed in `PROGRAM P()`
46* Missing parentheses allowed in `FUNCTION F`
47* Cray based `POINTER(p,x)` and `LOC()` intrinsic (with `%LOC()` as
48  an alias)
49* Arithmetic `IF`.  (Which branch should NaN take? Fall through?)
50* `ASSIGN` statement, assigned `GO TO`, and assigned format
51* `PAUSE` statement
52* Hollerith literals and edit descriptors
53* `NAMELIST` allowed in the execution part
54* Omitted colons on type declaration statements with attributes
55* COMPLEX constructor expression, e.g. `(x+y,z)`
56* `+` and `-` before all primary expressions, e.g. `x*-y`
57* `.NOT. .NOT.` accepted
58* `NAME=` as synonym for `FILE=`
59* Data edit descriptors without width or other details
60* `D` lines in fixed form as comments or debug code
61* `CONVERT=` on the OPEN and INQUIRE statements
62* `DISPOSE=` on the OPEN and INQUIRE statements
63* Leading semicolons are ignored before any statement that
64  could have a label
65* The character `&` in column 1 in fixed form source is a variant form
66  of continuation line.
67* Character literals as elements of an array constructor without an explicit
68  type specifier need not have the same length; the longest literal determines
69  the length parameter of the implicit type, not the first.
70* Outside a character literal, a comment after a continuation marker (&)
71  need not begin with a comment marker (!).
72* Classic C-style /*comments*/ are skipped, so multi-language header
73  files are easier to write and use.
74* $ and \ edit descriptors are supported in FORMAT to suppress newline
75  output on user prompts.
76* REAL and DOUBLE PRECISION variable and bounds in DO loops
77* Integer literals without explicit kind specifiers that are out of range
78  for the default kind of INTEGER are assumed to have the least larger kind
79  that can hold them, if one exists.
80* BOZ literals can be used as INTEGER values in contexts where the type is
81  unambiguous: the right hand sides of assigments and initializations
82  of INTEGER entities, and as actual arguments to a few intrinsic functions
83  (ACHAR, BTEST, CHAR).  But they cannot be used if the type would not
84  be known (e.g., `IAND(X'1',X'2')`).
85* BOZ literals can also be used as REAL values in some contexts where the
86  type is unambiguous, such as initializations of REAL parameters.
87* EQUIVALENCE of numeric and character sequences (a ubiquitous extension)
88* Values for whole anonymous parent components in structure constructors
89  (e.g., `EXTENDEDTYPE(PARENTTYPE(1,2,3))` rather than `EXTENDEDTYPE(1,2,3)`
90   or `EXTENDEDTYPE(PARENTTYPE=PARENTTYPE(1,2,3))`).
91* Some intrinsic functions are specified in the standard as requiring the
92  same type and kind for their arguments (viz., ATAN with two arguments,
93  ATAN2, DIM, HYPOT, MAX, MIN, MOD, and MODULO);
94  we allow distinct types to be used, promoting
95  the arguments as if they were operands to an intrinsic `+` operator,
96  and defining the result type accordingly.
97* DOUBLE COMPLEX intrinsics DREAL, DCMPLX, DCONJG, and DIMAG.
98* INT_PTR_KIND intrinsic returns the kind of c_intptr_t.
99* Restricted specific conversion intrinsics FLOAT, SNGL, IDINT, IFIX, DREAL,
100  and DCMPLX accept arguments of any kind instead of only the default kind or
101  double precision kind. Their result kinds remain as specified.
102* Specific intrinsics AMAX0, AMAX1, AMIN0, AMIN1, DMAX1, DMIN1, MAX0, MAX1,
103  MIN0, and MIN1 accept more argument types than specified. They are replaced by
104  the related generics followed by conversions to the specified result types.
105
106Extensions supported when enabled by options
107--------------------------------------------
108* C-style backslash escape sequences in quoted CHARACTER literals
109  (but not Hollerith) [-fbackslash]
110* Logical abbreviations `.T.`, `.F.`, `.N.`, `.A.`, `.O.`, and `.X.`
111  [-flogical-abbreviations]
112* `.XOR.` as a synonym for `.NEQV.` [-fxor-operator]
113
114Extensions and legacy features deliberately not supported
115---------------------------------------------------------
116* `.LG.` as synonym for `.NE.`
117* `REDIMENSION`
118* Allocatable `COMMON`
119* Expressions in formats
120* `ACCEPT` as synonym for `READ *`
121* `TYPE` as synonym for `PRINT`
122* `ARRAY` as synonym for `DIMENSION`
123* `VIRTUAL` as synonym for `DIMENSION`
124* `ENCODE` and `DECODE` as synonyms for internal I/O
125* `IMPLICIT AUTOMATIC`, `IMPLICIT STATIC`
126* Default exponent of zero, e.g. `3.14159E`
127* Characters in defined operators that are neither letters nor digits
128* `B` suffix on unquoted octal constants
129* `Z` prefix on unquoted hexadecimal constants (dangerous)
130* `T` and `F` as abbreviations for `.TRUE.` and `.FALSE.` in DATA (PGI/XLF)
131* Use of host FORMAT labels in internal subprograms (PGI-only feature)
132* ALLOCATE(TYPE(derived)::...) as variant of correct ALLOCATE(derived::...) (PGI only)
133* Defining an explicit interface for a subprogram within itself (PGI only)
134* USE association of a procedure interface within that same procedure's definition
135* NULL() as a structure constructor expression for an ALLOCATABLE component (PGI).
136* Conversion of LOGICAL to INTEGER.
137* IF (integer expression) THEN ... END IF  (PGI/Intel)
138* Comparsion of LOGICAL with ==/.EQ. rather than .EQV. (also .NEQV.) (PGI/Intel)
139* Procedure pointers in COMMON blocks (PGI/Intel)
140* Underindexing multi-dimensional arrays (e.g., A(1) rather than A(1,1)) (PGI only)
141* Legacy PGI `NCHARACTER` type and `NC` Kanji character literals
142* Using non-integer expressions for array bounds (e.g., REAL A(3.14159)) (PGI/Intel)
143* Mixing INTEGER types as operands to bit intrinsics (e.g., IAND); only two
144  compilers support it, and they disagree on sign extension.
145* Module & program names that conflict with an object inside the unit (PGI only).
146* When the same name is brought into scope via USE association from
147  multiple modules, the name must refer to a generic interface; PGI
148  allows a name to be a procedure from one module and a generic interface
149  from another.
150* Type parameter declarations must come first in a derived type definition;
151  some compilers allow them to follow `PRIVATE`, or be intermixed with the
152  component declarations.
153* Wrong argument types in calls to specific intrinsics that have different names than the
154  related generics. Some accepted exceptions are listed above in the allowed extensions.
155  PGI, Intel, and XLF support this in ways that are not numerically equivalent.
156  PGI converts the arguments while Intel and XLF replace the specific by the related generic.
157
158Preprocessing behavior
159======================
160* The preprocessor is always run, whatever the filename extension may be.
161* We respect Fortran comments in macro actual arguments (like GNU, Intel, NAG;
162  unlike PGI and XLF) on the principle that macro calls should be treated
163  like function references.  Fortran's line continuation methods also work.
164