This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/35203] OPTIONAL, VALUE actual argument cannot be an INTEGER 0
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Feb 2008 07:17:17 -0000
- Subject: [Bug fortran/35203] OPTIONAL, VALUE actual argument cannot be an INTEGER 0
- References: <bug-35203-109@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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