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/40054] [F08] Pointer functions as lvalue


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

--- Comment #10 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-07-03 16:29:01 UTC ---
(In reply to comment #7)
> I think it will be very hard (if not impossible) to implement this, while
> maintaining support for statement functions at the same time. In particular,
> how is one supposed to interpret a statement like:
> f (x) = x + 1

That depends on the context. The function "f(x)" is only a variable if "f"
returns a pointer - and those functions are required to have an explicit
interface (cf. "12.4.2.2 Explicit interface").

Thus, the ambiguity can only occur if one host-associates an explicit interface
of "f". But the following makes clear how to interpret the program in that case
(from "12.6.4 Statement function"):

"The definition of a statement function with the same name as an accessible
entity from the host shall be preceded by the declaration of its type in a type
declaration statement."


> In any case, statement functions are obsolescent since F95, so would it be an
> option to not support them with -std=f2008?

No. They are just obsolescent - not deleted:

"Better methods existed in Fortran 90 and Fortran 95 for each obsolescent
feature. It is recommended that programmers use these better methods in new
programs and convert existing code to these methods. [...]  A future revision
of this part of ISO/IEC 1539 might delete an obsolescent feature if its use has
become insignificant." (From "1.7.3 Nature of obsolescent features")

Besides, with -std=gnu, we want to support both old and Fortran 2008 conform
programs ...


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