PROGRAM Error ^ cf90-955 f90comp: ERROR ERROR, File = contain1.f90, Line = 1, Column = 1 Program "ERROR" is missing an END statement. END Error ^ cf90-1009 f90comp: ERROR $MAIN, File = contain1.f90, Line = 14, Column = 1 This compilation unit contains multiple main program units. ^ cf90-186 f90comp: ERROR $MAIN, File = contain1.f90, Line = 14, Column = 5 Unexpected syntax: Expecting "PROGRAM" to follow the END keyword, but found "ERROR". f90: SunSoft F90 Version 1.0.1.0 (21229283) Fri Nov 14, 1997 18:05:07 f90: COMPILE TIME 0.100000 SECONDS f90: MAXIMUM FIELD LENGTH 2479728 DECIMAL WORDS f90: 14 SOURCE LINES f90: 3 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI f90: CODE: 0 WORDS, DATA: 0 WORDS
Well, this program does have PROGRAM and END statements. What is the problem? Very simple:PROGRAM Error IMPLICIT NONE INTEGER :: a, b, c READ(*,*) a, b CALL Problem(a, b, c) SUBROUTINE Problem(u, v, w) IMPLICIT NONE INTEGER, INTENT(IN) :: u, v INTEGER, INTENT(OUT) :: w w = u + v END SUBROUTINE Problem END Error
Replacing PROGRAM with MODULE would yield the same message.
CALL Sub2(x, y) ^ cf90-786 f90comp: ERROR SUB1, File = arg1.f90, Line = 15, Column = 21 An actual argument must be definable when associated with a dummy argument that has INTENT(OUT) or INTENT(INOUT). f90: SunSoft F90 Version 1.0.1.0 (21229283) Sat Nov 15, 1997 05:13:11 f90: COMPILE TIME 0.070000 SECONDS f90: MAXIMUM FIELD LENGTH 2479728 DECIMAL WORDS f90: 27 SOURCE LINES f90: 1 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI f90: CODE: 0 WORDS, DATA: 0 WORDS
Take a look at the following example.
In subroutine Sub2(), since formal argument n is declared with INTENT(OUT), its corresponding actual argument y in subroutine Sub1() must be modifiable. However, in subroutine Sub1(), formal argument y is declared with INTENT(IN), which means its value cannot be changed. Therefore, the requested INTENT(OUT) cannot be performed and this is the meaning of the message.PROGRAM Arguments IMPLICIT NONE INTEGER :: a, b, c READ(*,*) a, b CALL Sub1(a, b, c) WRITE(*,*) a, b, c CONTAINS SUBROUTINE Sub1(x, y, z) IMPLICIT NONE INTEGER, INTENT(IN) :: x, y INTEGER, INTENT(OUT) :: z CALL Sub2(x, y) z = x + y END SUBROUTINE Sub1 SUBROUTINE Sub2(m, n) IMPLICIT NONE INTEGER, INTENT(IN) :: m INTEGER, INTENT(OUT) :: n n = 2*m END SUBROUTINE Sub2 END PROGRAM Arguments