[Bug fortran/93827] fails to initialize logical variable
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 6 17:59:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93827
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to dan hayes from comment #2)
> u say "unlike C ....only occurs once..." Yea so what I know that and it's
> not consistently doing that. This is not a recursive routine. What is your
> point?
>
Please use English in your responses.
Please find a reference on the Fortran program language.
Mark's response is correct. If you use
logical*1 :: fl=.false.
in a function (or subroutine), then the first time that the
function is called the variable 'fl is initialized to .false.
When the function or subroutine returns, the variable 'fl'
retains whatever its last value was. The next invocation of
that function will used that *retained value*. This has
nothing to do with recursion. It is the semantics of the
language. If 'fl' needs to be .false. at the start of then
function on every invocation, then you need to use an
assignment.
More information about the Gcc-bugs
mailing list