- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have recently upgraded to the Version 11 compiler under Visual Studio 2005. I am working on several large legacy F77 Fortran projects, and when I turn on the Interface Checking option I run into the following problem involving scalar arguments passed to dummy array arguments. As a typical example I have a 1-D interpolation subroutine INTERP1 that performs local quadratic interpolation to provide both an interpolated function value and its first derivative.
SUBROUTINE INTERP1(Nintp, Xintp, Yintp, Ypintp, Ntbl, Xtbl, Ytbl)
....
INTEGER :: Nintp, Ntbl
REAL :: Xintp(*), Yintp(*), Ypintp(*), Xtbl(*), Ytbl(*)
.....
END
In my legacy F77 project this subroutine gets called numerous times with both with 1-D vector arguments for multiple interpolated output points and with scalar arguments for a single interpolated output point.
INTEGER :: Nvec, Ntbl, Nscl
REAL :: Xvec(Nvec), Yvec(Nvec), Ypvec(Nvec)
REAL :: Xtbl(Ntbl), Ytbl(Ntbl)
REAL :: Xscl, Yscl, Ypscl
...............
CALL INTERP1(Nvec, Xvec, Yvec, Ypvec, Ntbl, Xtbl, Ytbl)
Nscl = 1
CALL INTERP1(Nscl, Xscl, Yscl, Ypscl, Ntbl, Xtbl, Ytbl)
With interface checking turned off this vector/scalar argument usage compiles and runs. With interface checking turned on I get the following typical three error messages per scalar call usage of the subroutine INTERP1.
error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. [Xscl] C:\\NSS_Office\\Intel Fortran Projects\\HydroV6\\trunk\\HydroV_Lib\\EBHYDRO.FOR 373
error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. [Yscl] C:\\NSS_Office\\Intel Fortran Projects\\HydroV6\\trunk\\HydroV_Lib\\EBHYDRO.FOR 373
error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. [Ypscl] C:\\NSS_Office\\Intel Fortran Projects\\HydroV6\\trunk\\HydroV_Lib\\EBHYDRO.FOR 373
How do I fix this type of problem for actual arguments vs dummy arguments? It is leading to a "ton" of error messages with my F77 projects.
Thanks,
Neill Smith
SUBROUTINE INTERP1(Nintp, Xintp, Yintp, Ypintp, Ntbl, Xtbl, Ytbl)
....
INTEGER :: Nintp, Ntbl
REAL :: Xintp(*), Yintp(*), Ypintp(*), Xtbl(*), Ytbl(*)
.....
END
In my legacy F77 project this subroutine gets called numerous times with both with 1-D vector arguments for multiple interpolated output points and with scalar arguments for a single interpolated output point.
INTEGER :: Nvec, Ntbl, Nscl
REAL :: Xvec(Nvec), Yvec(Nvec), Ypvec(Nvec)
REAL :: Xtbl(Ntbl), Ytbl(Ntbl)
REAL :: Xscl, Yscl, Ypscl
...............
CALL INTERP1(Nvec, Xvec, Yvec, Ypvec, Ntbl, Xtbl, Ytbl)
Nscl = 1
CALL INTERP1(Nscl, Xscl, Yscl, Ypscl, Ntbl, Xtbl, Ytbl)
With interface checking turned off this vector/scalar argument usage compiles and runs. With interface checking turned on I get the following typical three error messages per scalar call usage of the subroutine INTERP1.
error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. [Xscl] C:\\NSS_Office\\Intel Fortran Projects\\HydroV6\\trunk\\HydroV_Lib\\EBHYDRO.FOR 373
error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. [Yscl] C:\\NSS_Office\\Intel Fortran Projects\\HydroV6\\trunk\\HydroV_Lib\\EBHYDRO.FOR 373
error #7836: If the actual argument is scalar, the corresponding dummy argument shall be scalar unless the actual argument is an element of an array that is not an assumed-shape or pointer array, or a substring of such an element. [Ypscl] C:\\NSS_Office\\Intel Fortran Projects\\HydroV6\\trunk\\HydroV_Lib\\EBHYDRO.FOR 373
How do I fix this type of problem for actual arguments vs dummy arguments? It is leading to a "ton" of error messages with my F77 projects.
Thanks,
Neill Smith
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your program is not legal Fortran 77 in that it passes a scalar to an array. Most older compilers do not catch this error. You can either turn off interface checking, or turn the scalar argument(s) into an array like this:
CALL INTERP1(Nscl, [Xscl], [Yscl], [Ypscl], Ntbl, Xtbl, Ytbl)
For further reading, see the section on Sequence Association here.
CALL INTERP1(Nscl, [Xscl], [Yscl], [Ypscl], Ntbl, Xtbl, Ytbl)
For further reading, see the section on Sequence Association here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve! That little trick has just saved me a heap of recoding -- it works like a charm.
Neill Smith
Neill Smith
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page