- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my new version compiler is ifort version 19.0.2.187
my old version compiler is ifort version 15.0.3
system is linux(redhat)
my code use old compiler and link ,code run is right,
but we change to new compiler ,compiles have waring message ,and my cod run is wrong .
following parameter trc, channel is optional default trc = 1 and channel = 0
following is new compiler waring:
ifort -c head_sublibf.f90 -std03 -fPIC -assume nounderscore -assume bscc -assume byterecl -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fpp
head_sublibf.f90(32): warning #8809: An OPTIONAL or EXTERNAL dummy argument to a BIND(C) procedure is not interoperable. [TRC]
integer( c_int ) function hdd_geti_by_no(no,head_buffer,result,trc,channel ) bind( C )
head_sublibf.f90(32): warning #8809: An OPTIONAL or EXTERNAL dummy argument to a BIND(C) procedure is not interoperable. [CHANNEL]
integer( c_int ) function hdd_geti_by_no(no,head_buffer,result,trc,channel ) bind( C )
please help me ,thank!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like that you used a sloppiness of the Intel compiler in earlier versions for your code that is now detected by Intel regarding bind(C), but without seeing the code that is speculation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An OPTIONAL argument is interoperable in Fortran 2008. ifort gives this warning only if you ask for Fortran 2003 standards checking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a reason why OPTIONAL argument produces warnings in the later Fortran versions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
AT90 wrote:Is there a reason why OPTIONAL argument produces warnings in the later Fortran versions?
@AT90,
See Steve Lionel's feedback above. The warning occurs in Intel Fortran compiler depending on the -stand compiler option i.e., whether it's -stand=f03 in the context of interoperability with a companion C processor e.g., the BIND(C) option introduced starting with Fortran 2003 standard revision and where further enhancements have been introduced with Fortran 2008 and 2018 standard revisions.
Readers can notice this with a trivial example:
module m use, intrinsic :: iso_c_binding, only : c_int interface subroutine sub( a ) bind( C ) import :: c_int implicit none integer(c_int), optional :: a end subroutine end interface end module
Intel Fortran compiler response is as follows, note the difference when -stand=f03 is applied and when it is not:
C:\Temp>type m.f90 module m use, intrinsic :: iso_c_binding, only : c_int interface subroutine sub( a ) bind( C ) import :: c_int implicit none integer(c_int), optional :: a end subroutine end interface end module C:\Temp>ifort /c /standard-semantics /warn:all /stand:f03 /check:all m.f90 Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.4.245 Build 20190417 Copyright (C) 1985-2019 Intel Corporation. All rights reserved. m.f90(4): warning #8809: An OPTIONAL or EXTERNAL dummy argument to a BIND(C) procedure is not interoperable. subroutine sub( a ) bind( C ) ----------------------^ C:\Temp>ifort /c /standard-semantics /warn:all /stand:f18 /check:all m.f90 Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.4.245 Build 20190417 Copyright (C) 1985-2019 Intel Corporation. All rights reserved. C:\Temp>
Also note the current Fortran standard states in section 18.3.6 Interoperability of procedures and procedure interfaces:
7 7 If an interoperable procedure defined by means other than Fortran has an optional dummy argument, and the 8 corresponding actual argument in a reference from Fortran is absent, the procedure is invoked with a null pointer 9 for that argument. If an interoperable procedure defined by means of Fortran is invoked by a C function, an 10 optional dummy argument is absent if and only if the corresponding argument in the invocation is a null pointer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I haven't tried older versions, but it is possible that older versions didn't check for OPTIONAL here for standards warnings. In F2003, OPTIONAL was not allowed in an interoperable interface, in F2008 it was. I recall the discussions about this at my first WG5 meeting almost eleven years ago - the issue was that at least one vendor used a mechanism other than a zero address to indicate an omitted argument, and they objected (but were outvoted.)
Vendors are free to improve and add diagnostics in new versions. Just because an old version didn't complain, that doesn't mean the usage is valid or standard-conforming.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page