This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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.


[rearranging the CC list a bit]

> Now, given that this is illegal, an adventurous Fortran compiler 
> engineer (e.g., X maintaining gfortran fifteen years after you have 
> abandoned it), might turn:
>
> subroutine sub1(a, b)
> intent(in) :: a
> intent(out) :: b
> if (a > 0) b = log(a)
> end
>
> into:
>
> subroutine sub1(a, b)
> intent(in) :: a
> intent(out) :: b
> real c
> if (a > 0) c = log(a)
> b = c
> end

Yes, I agree that this is the case for intent(out) variables.
Does the same apply if the intent is _not_ specified. 

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?

Paul


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