ERROR STOP
or STOP
statement can be non-constant.
It is still required to be default Integer or default Character.
ERROR STOP
and STOP
statements now have an optional QUIET=
specifier,
which is preceded by a comma following the optional stop-code.
This takes a Logical expression; if it is true at runtime then the STOP
(or
ERROR STOP
) does not output any message, and information about any IEEE exceptions
that are signalling will be suppressed.
For example,
STOP 13, QUIET = .True.will not display the usual ‘STOP: 13’, but simply do normal termination, with a process exit status of 13. Note that this means that the following two statements are equivalent:
STOP, QUIET=.True. STOP 'message not output', QUIET=.TRUE.
IF
statement has been deleted; this is because the behaviour when the expression is an IEEE NaN
is undefined, and can have no good definition.
It still remains in the NAG Fortran Compiler, but is reported as Deleted feature.
For example, if the file del.f90
contains
Subroutine sub(x) Real,Intent(In) :: x If (x) 1,2,3 1 Stop 1 2 Stop 2 3 Stop 3 End Subroutinethis warning message will be produced:
Deleted feature used: del.f90, line 3: Arithmetic IF statement
DO CONCURRENT
construct can have locality specifiers LOCAL
, LOCAL_INIT
, and SHARED
.
These locality specifiers determine how a variable can be used within and without the loop, and cannot be applied to
the loop index variables, which are always effectively LOCAL
.
There is also a DEFAULT(NONE)
locality specifier, which requires all variables used in DO CONCURRENT
to be
given an explicit locality.
The revised syntax of the DO CONCURRENT
statement, ignoring labels and construct names, is:
DO CONCURRENT
concurrent-header [ locality-spec ]...
LOCAL (
variable-name-list )
LOCAL_INIT (
variable-name-list )
SHARED (
variable-name-list )
DEFAULT (NONE)
LOCAL
or LOCAL_INIT
specifier must be a rather ordinary variable:
it must not have the ALLOCATABLE
or OPTIONAL
attribute, must not have have an allocatable ultimate
component, and must not be a coarray or an assumed-size array.
If it is polymorphic, it must have the POINTER
attribute.
Finally, it must be permitted to appear in a variable definition context: for example, it cannot be INTENT(IN)
.
The effect of LOCAL
and LOCAL_INIT
is that the variable inside the construct is completely separate from
the one outside the construct; if LOCAL
, it begins each iteration undefined, and if LOCAL_INIT
it begins
each iteration with the value of the outside variable.
This ensures that LOCAL
and LOCAL_INIT
variables cannot cause any dependency between iterations.
A variable that is SHARED
is the same variable inside the construct as outside.
If it is given a value by any iteration, it must not be referenced or given a value by any other iteration.
If it is allocatable or a pointer, it similarly must only be allocated, deallocated, or pointer-assigned by a single iteration.
If a discontiguous array is SHARED
, it must not be passed as an actual argument to a contiguous dummy argument (i.e.
the dummy must be assumed-shape or a pointer, and must not have the CONTIGUOUS
attribute).
DO
construct with a label is considered to be Obsolescent
(it is effectively replaced by the END DO
statement and construct labels).
Furthermore, the non-block DO
construct has been deleted (but remains in the
NAG Fortran Compiler, reported as a Deleted feature).
A non-block DO
is either two or more nested DO
loops with a shared DO
termination label,
or a DO
loop with a terminating statement other than END DO
or CONTINUE
.
(These are obsolescent/deleted because these are hard to understand, error-prone,
and better functionality has been available via the block DO
construct since Fortran 90.)
For example, if the file obsdel.f90
contains
Subroutine sub(w,x,y) Real,Intent(InOut) :: w(:),x(:,:), y(:) Integer i,j Do 100 i=1,Size(w) w(i) = w(i)**2 + 4*w(i) - 4 100 Continue Do 200 j=1,Size(x,2) Do 200 i=1,Size(x,1) If (x(i,j)<0) Go To 200 x(i,j) = Sqrt(x(i,j)+1) 200 Continue Do 300 i=1,Size(y) If (y(i)<0) Go To 300 y(i) = Log(y(i)) 300 Print *,y(i) End Subroutinethese warning messages will be produced:
Obsolescent: obsdel.f90, line 4: DO statement with label (100) Obsolescent: obsdel.f90, line 7: DO statement with label (200) Obsolescent: obsdel.f90, line 8: DO statement with label (200) Deleted feature used: obsdel.f90, line 11: 200 is a shared DO termination label Obsolescent: obsdel.f90, line 12: DO statement with label (300) Deleted feature used: obsdel.f90, line 15: DO 300 ends neither with CONTINUE nor ENDDO
FORALL
statement and construct are considered to be Obsolescent.
This is because it usually has worse performance than ordinary DO
or DO CONCURRENT
.
For example, if the file obs.f90
contains
Subroutine sub(a,b,c) Real,Intent(InOut) :: a(:) Real,Intent(In) :: b(:),c Integer i Forall(i=1:Size(a)) a(i) = b(i)**2 - c End Forall End Subroutinethis warning message will be produced:
Obsolescent: obs.f90, line 5: FORALL construct