mecej4
Joined: 31 Oct 2006 Posts: 1823
|
Posted: Wed Sep 06, 2023 6:54 pm Post subject: Compiler issues strange error message for correct code |
|
|
The following code is correct Fortran (checked with Gfortran).
Code: | module pars_m
implicit none
integer, parameter :: NMAX = 101, MMAX = 50
end module pars_m
module l2_c
use pars_m
implicit none
real x(NMAX)
end module
module l3_c
use pars_m
implicit none
real dgtp(MMAX,NMAX)
end module
module l4_c
implicit none
real fx
end module
module comnset_m ! combine contents and rename some
use l2_c
use l3_c, gg => dgtp
use l4_c
implicit none
integer :: n, nili, ninl, neli, nenl
end module
subroutine tp1(mode)
use comnset_m
implicit none
integer mode
if (mode == 1) then
n=2
nili=0
ninl=0
neli=0
nenl=0
x(1)=-2.d0
x(2)=1.d0
else
fx=100.d0*(x(2)-x(1)**2)**2+(1.d0-x(1))**2
endif
return
end |
The compiler issues a strange error message:
Code: | ERROR S:\ALGO\NLPQP\tbed\salbug\salgg.F90 32: Variable GG has already been declared as part of the COMMON block /@@L3_C!DGTP/ |
The code itself contains no COMMON blocks. The variable GG is in scope in the subroutine, but is not referenced at all. |
|