This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] Fix NULL reference types.


ie. is the following program legal?

subroutine sub1(a, b)
if (a > 0) b = log(a)
end

program prog
  integer i, j
  call sub1(0, 0)
  i = 1
  call sub1(i, j)
end program

Does the fact that b is redefined on some invocations of sub1 imply that every
actual argument associated with b must be definable?

The language in F77 (15.9.3.2) is: "If the actual argument is a constant ... the associated dummy argument must not be redefined within the subprogram." By itself, that is not totally clear; does that mean redefined anywhere in the subprogram, or is redefinition a runtime property? From 15.8.4 it appears that "defined" and "redefined" are indeed runtime properties, so this seems to be valid. I do not have F90, but what I do have (Metcalf/Reid book) does not indicate any intent to deviate from F77 in this area.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]