gfortran allows variable to be declared twice

Vivek Rao via fortran fortran@gcc.gnu.org
Tue May 2 16:33:00 GMT 2017


The first two lines of the code were munged together. The code should be

function foo(fp, m) result(ft) 
real   , intent(in) :: fp(m) 
integer, intent(in) :: m 
integer             :: m 
ft = 0.0 
end function foo


----- Original Message -----
From: Vivek Rao <vivekrao4@yahoo.com>
To: "fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Sent: Tuesday, May 2, 2017 12:22 PM
Subject: gfortran allows variable to be declared twice


The code


function foo(fp, m) result(ft)real   , intent(in) :: fp(m)

integer, intent(in) :: m

integer             :: m

ft = 0.0


end function foo


declares "m" twice, but GNU Fortran (GCC) 7.0.1 20170122 (experimental) on Windows 10 compiles it.

If fp(m) is replace by fp, gfortran catches the error.


Thanks to the gfortran developers for their efforts.



More information about the Fortran mailing list