- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a code that I've developed with ifc 7.1, but which does not seem to compile under ifort 8.0. The first problem appears to be with two module procedures using OPTIONAL dummy arguments. I would like to note that this problem has not appeared in any other compiler I've used, namely ifc 7.1, a Sun f90 compiler, and lf95 (sorry don't have the version info on-hand).
The error messages generated by ifort are:
fortcom: Error: io_mod.f90, line 25: In specification expressions, dummy arguments must not have the OPTIONAL attribute. [FILE]
integer function open_input_file( file, debug )
....................................^
fortcom: Error: io_mod.f90, line 778: In specification expressions, dummy arguments must not have the OPTIONAL attribute. [FILE]
integer function init( file )
..........................^
The interfaces for the procedures (i.e., as it is written in the module, which provides the explicit interface) in question are:
integer function open_input_file( file, debug )
character(*), intent(in), optional :: file
character(7), intent(in), optional :: debug
character(len(file)) :: fileIn
character(7) :: debugOut
character(30) :: fileClean
integer :: unitIn
integer :: unitOut
integer :: unitScratch
integer :: errCode
logical(logDef_k) :: exists, open
character(len(fileClean)) :: fileName
end function open_input_file
integer function init( file )
character(*), intent(in), optional :: file
character(len(file)) :: fileIn
integer :: fileUnit
integer :: errCode
integer :: initCode
integer :: caseCode
integer :: numNegCases
end function init
Also, these routines are always called using keywords for the dummy arguements so that there are no ambiguities.
Any and all help will be appreciated. I've looked in the "Known defects" and User's Guides, but cannot find any reason my code is flawed. Perhaps a newer vesion of the compiler will help, but I've still not figured out how to obtain one, though I've emailed support about it.
System:
RedHat Linux 8.0 (old, but working)
Athlon Processor, though the primary reason to use ifort 8.0 is to move the code to a P4 processor running RedHat Enterprise WS 3.0.
I have a code that I've developed with ifc 7.1, but which does not seem to compile under ifort 8.0. The first problem appears to be with two module procedures using OPTIONAL dummy arguments. I would like to note that this problem has not appeared in any other compiler I've used, namely ifc 7.1, a Sun f90 compiler, and lf95 (sorry don't have the version info on-hand).
The error messages generated by ifort are:
fortcom: Error: io_mod.f90, line 25: In specification expressions, dummy arguments must not have the OPTIONAL attribute. [FILE]
integer function open_input_file( file, debug )
....................................^
fortcom: Error: io_mod.f90, line 778: In specification expressions, dummy arguments must not have the OPTIONAL attribute. [FILE]
integer function init( file )
..........................^
The interfaces for the procedures (i.e., as it is written in the module, which provides the explicit interface) in question are:
integer function open_input_file( file, debug )
character(*), intent(in), optional :: file
character(7), intent(in), optional :: debug
character(len(file)) :: fileIn
character(7) :: debugOut
character(30) :: fileClean
integer :: unitIn
integer :: unitOut
integer :: unitScratch
integer :: errCode
logical(logDef_k) :: exists, open
character(len(fileClean)) :: fileName
end function open_input_file
integer function init( file )
character(*), intent(in), optional :: file
character(len(file)) :: fileIn
integer :: fileUnit
integer :: errCode
integer :: initCode
integer :: caseCode
integer :: numNegCases
end function init
Also, these routines are always called using keywords for the dummy arguements so that there are no ambiguities.
Any and all help will be appreciated. I've looked in the "Known defects" and User's Guides, but cannot find any reason my code is flawed. Perhaps a newer vesion of the compiler will help, but I've still not figured out how to obtain one, though I've emailed support about it.
System:
RedHat Linux 8.0 (old, but working)
Athlon Processor, though the primary reason to use ifort 8.0 is to move the code to a P4 processor running RedHat Enterprise WS 3.0.
Message Edited by wellsed@glue.umd.edu on 07-16-2004 02:08 PM
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The compiler is correct. You have an optional argument file, and then use len(file) in a specification expression. This is not allowed - the standard says:
"... an expression in which each operation is intrinsic and each primary is ...
(2) A variable that is a dummy argument that has neither the OPTIONAL nor the INTENT(OUT) attribute, or a variable that is a subobject of such a dummy argument."
[Fortran 95, section 7.1.6.2, page 95]
It doesn't matter how you call the routine - a specification expression must always be able to be evaluated, and if it depends on an OPTIONAL argument, it can't.
A possible solution is to make the routine generic, one with a file argument and one without - the one without obviously would not need to ask len(file).
Message Edited by sblionel on 07-16-2004 05:04 PM

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