bug in to_f90 regarding INTENT
beliavsky_at_aol.com
Date: 01/27/04
- Next message: James Giles: "Re: Help from fellow Fortran Users"
- Previous message: John Harper: "Re: Help from fellow Fortran Users"
- Next in thread: miller: "Re: bug in to_f90 regarding INTENT"
- Reply: miller: "Re: bug in to_f90 regarding INTENT"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Jan 2004 14:42:40 -0800
I think I have found a small bug in Alan Miller's useful to_f90.f90
program, (downloadable at
http://users.bigpond.net.au/amiller/to_f90.f90 ) , which converts
fixed format F77 form to free format and makes other stylistic
changes.
The to_f90 program transforms some F77 subroutine argument
declarations so that they have INTENT(OUT), when I think they should
have INTENT(IN OUT).
Here is an example. The F77 program
subroutine twice(xx)
real xx
xx = 2.0*xx
end
program xtwice
xx = 3.0
call twice(xx)
print*,xx
end
is transformed to
SUBROUTINE twice(xx)
! Code converted using TO_F90 by Alan Miller
! Date: 2004-01-27 Time: 17:16:02
REAL, INTENT(OUT) :: xx
xx = 2.0*xx
END SUBROUTINE twice
PROGRAM xtwice
xx = 3.0
CALL twice(xx)
PRINT*,xx
END PROGRAM xtwice
Because xx is declared INTENT(OUT), Compaq Visual Fortran 6.6C
correctly gives the warning
inout.f90(9) : Warning: Variable XX is used before its value has been
defined
xx = 2.0*xx
There is nothing unusual about the F77 code above, except for its
brevity, so it appears to me that to_f90 subtly mistranslates a wide
range of F77 code.
Most compilers on most settings will print 6.0 as the output of the
program, but this is not guaranteed -- I asked about this in an
"intent(out) arguments" thread about a month ago.
- Next message: James Giles: "Re: Help from fellow Fortran Users"
- Previous message: John Harper: "Re: Help from fellow Fortran Users"
- Next in thread: miller: "Re: bug in to_f90 regarding INTENT"
- Reply: miller: "Re: bug in to_f90 regarding INTENT"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|