This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/35203] OPTIONAL, VALUE actual argument cannot be an INTEGER 0



------- Comment #6 from burnus at gcc dot gnu dot org  2008-02-15 07:17 -------
> As I am at a WG5 just right now, I decided to ask.  Allowing OPTIONAL,VALUE
> was a conscious decision by the Committee (although not necessarily an
> unanimous one :-)

Can you ask the other vendors how they plan to implement it? Or if you find a
non-vendor proponent, how he would implement it.

For a pointer (C sense) it is easy:

if (pointer == NULL) -> check for presence
if (*pointer == 0) -> check for its value

But if I have a value, there is no chance to check for it directly - except for
passing a hidden argument; unless we can convince J3/WG5 to change their
opinion, that is what I propose to do. The hidden argument would then be added
after the character length arguments.

As written, I checked all my compilers and all get a wrong result
- gfortran, g95, NAG f95: NOT PRESENT
- ifort: PRESENT, WITH VALUE: 0   (even if not present)
  (ifort 10 and ifort 10.1 print a warning that present should not be used with 
  value; ifort 9 give the same run-time result, but does not have the warning)
- sunf95: Compile-time error: OPTIONAL and VALUE may not be used both

(While we are at it: Please make sure that OPTION + VALUE + BIND(C) will not be
allowed in the upcoming interoperability TR; if it is included, there should be
a note giving implementation suggestions. F2003 is unaffected by this as
OPTIONAL is not allowed with BIND(C).)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35203


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