public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40264]  New: Recursive constraint for specific calling same-named generic procedure
@ 2009-05-26 21:15 burnus at gcc dot gnu dot org
  2009-05-28 16:02 ` [Bug fortran/40264] " fxcoudert at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-05-26 21:15 UTC (permalink / raw)
  To: gcc-bugs

Interpretation request tracking bug

 * * *

Found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/c05874d85748d9e6

The problem is
  function f() result(res)
    res = f(something)

where "f" is both a specific and a generic function and "f(something)" matches
a the different generic function.

However, Section 12.5.2.1 of Fortran 2003 has:
"If RESULT is specified, [...] all occurrences of the
 function name in execution-part statements in the
 scoping unit refer to the function itself."

This somehow clashes with other parts of the standard and it is currently
unclear whether the program is valid. Some compilers accept it (e.g. gfortran),
others reject it.

  * * *

Submitted as interpretation request for
J3 MEETING 189 LAS VEGAS, NEVADA, August 10 - 14, 2009
http://www.j3-fortran.org/doc/year/09/paper189.txt

Presumably will be:
http://www.j3-fortran.org/doc/year/09/09-237.txt


-- 
           Summary: Recursive constraint for specific calling same-named
                    generic procedure
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/40264] Recursive constraint for specific calling same-named generic procedure
  2009-05-26 21:15 [Bug fortran/40264] New: Recursive constraint for specific calling same-named generic procedure burnus at gcc dot gnu dot org
@ 2009-05-28 16:02 ` fxcoudert at gcc dot gnu dot org
  2009-05-28 16:03 ` fxcoudert at gcc dot gnu dot org
  2009-08-16 12:32 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-28 16:02 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-28 16:02:35
               date|                            |


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/40264] Recursive constraint for specific calling same-named generic procedure
  2009-05-26 21:15 [Bug fortran/40264] New: Recursive constraint for specific calling same-named generic procedure burnus at gcc dot gnu dot org
  2009-05-28 16:02 ` [Bug fortran/40264] " fxcoudert at gcc dot gnu dot org
@ 2009-05-28 16:03 ` fxcoudert at gcc dot gnu dot org
  2009-08-16 12:32 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-28 16:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/40264] Recursive constraint for specific calling same-named generic procedure
  2009-05-26 21:15 [Bug fortran/40264] New: Recursive constraint for specific calling same-named generic procedure burnus at gcc dot gnu dot org
  2009-05-28 16:02 ` [Bug fortran/40264] " fxcoudert at gcc dot gnu dot org
  2009-05-28 16:03 ` fxcoudert at gcc dot gnu dot org
@ 2009-08-16 12:32 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-08-16 12:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-08-16 12:32 -------
Interpretation request has been answered, cf.
http://www.j3-fortran.org/doc/year/09/09-237r1.txt

The following program is invalid but accepted by gfortran:

  MODULE example
    INTERFACE f
      MODULE PROCEDURE f0,f
    END INTERFACE
  CONTAINS
    INTEGER FUNCTION f0(n) RESULT(y)
      y = n + 1
    END FUNCTION
    INTEGER FUNCTION f(n1,n2) RESULT(y2)
      y2 = f(n1+n2)
    END FUNCTION
  END MODULE

Expected: As NAG f95 prints:
Error: line 10: Invalid recursive self-reference to F

Or in other words: The "f" refers to the specific function.



>From the interpretation request:

Edits are supplied to correct the rules in 12.4.4 to account for
recursive self-references to functions with RESULT clauses.  The
function F should be established to be specific, and the reference
should be to itself.

EDITS:

[276:36+] Insert new case
  "(a2) if the scoping unit is a subprogram that defines a procedure
        with that name;"
{Establish the name to be (only) specific.}

[278:15+] Insert new case
  "(3a) If the scoping unit is a subprogram that defines a procedure
        with that name, the reference is to that procedure."
{Resolve to the procedure.}


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |NEW
   Last reconfirmed|2009-05-28 16:02:35         |2009-08-16 12:32:05
               date|                            |


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-16 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-26 21:15 [Bug fortran/40264] New: Recursive constraint for specific calling same-named generic procedure burnus at gcc dot gnu dot org
2009-05-28 16:02 ` [Bug fortran/40264] " fxcoudert at gcc dot gnu dot org
2009-05-28 16:03 ` fxcoudert at gcc dot gnu dot org
2009-08-16 12:32 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).