Fortran Compiler Bug? USE statement renaming
The Fortran compiler
f90: Sun Fortran 95 8.2 Patch 121020-05 2006/12/08
complain, incorrectly I believe, about a renaming in a USE statement. Here is the source code:
MODULE mod
INTEGER :: m
CONTAINS
SUBROUTINE sub_mod(m1,x)
INTEGER, INTENT(in) :: m1
REAL :: x(m)
x = 3.
END SUBROUTINE sub_mod
END MODULE mod
SUBROUTINE sub(m,isum)
USE mod, mod_m => m
INTEGER :: m, isum
isum = m + mod_m
RETURN
END
The compiler says:
f90 -c LStest16.f
USE mod, mod_m => m
^
"LStest16.f", Line = 12, Column = 11: ERROR: "M" is the name of a dummy argument to program unit "SUB", therefore it must not be use associated from module "MOD".
^
"LStest16.f", Line = 12, Column = 11: ERROR: "M" has been use associated from module "MOD" and at least one more module. It must not be referenced.
f90comp: 16 SOURCE LINES
f90comp: 2 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
Note that changing from
REAL :: x(m)
to
REAL :: x(m1)
in the sixth line makes the compiler happy.
Seems odd to me.

