public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34004]  New: Accepts invalid: Ambigiuous interface with subroutine.
@ 2007-11-06 14:16 burnus at gcc dot gnu dot org
  2007-11-07 11:02 ` [Bug fortran/34004] " pault at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-06 14:16 UTC (permalink / raw)
  To: gcc-bugs

After PR 33997 turned out to be no bug, there is the following program, which
gfortran wrongly accepts.

A bit oddly the Fortran standard does not distinguish between variables and
functions and subroutines are wild matches. The following is the relevant part
from the Fortran 2003 standard ("16.2.3 Restrictions on generic declarations"):

"Two dummy arguments are distinguishable if neither is a subroutine and neither
is TKR compatible (5.1.1.2) with the other."

module ambiguous
   implicit none
   interface both
      module procedure test1, test2
   end interface both
   contains
      function test1(x)
         implicit integer(x)
         integer test1

         test1 = 1
      end function test1

      function test2(x)
         interface
            subroutine x()
            end subroutine x
         end interface
         integer test2

         test2 = 2
      end function test2

      subroutine test3
      end subroutine test3
end module ambiguous

program main
   use ambiguous
   implicit none

   write(*,*) both(1)
   write(*,*) both(test3)
end program main


-- 
           Summary: Accepts invalid: Ambigiuous interface with subroutine.
           Product: gcc
           Version: 4.3.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=34004


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
  2007-11-06 14:16 [Bug fortran/34004] New: Accepts invalid: Ambigiuous interface with subroutine burnus at gcc dot gnu dot org
@ 2007-11-07 11:02 ` pault at gcc dot gnu dot org
  2007-11-08 10:33 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-11-07 11:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2007-11-07 11:02 -------

> 
> "Two dummy arguments are distinguishable if neither is a subroutine and neither
> is TKR compatible (5.1.1.2) with the other."

Does this mean, though, that a subroutine is or is not distinguishable from a
variable?  I can see nothing in the 95 or 2003 that clarifies this question.

Cheers

Paul


-- 


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


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
  2007-11-06 14:16 [Bug fortran/34004] New: Accepts invalid: Ambigiuous interface with subroutine burnus at gcc dot gnu dot org
  2007-11-07 11:02 ` [Bug fortran/34004] " pault at gcc dot gnu dot org
@ 2007-11-08 10:33 ` burnus at gcc dot gnu dot org
  2007-12-14 12:33 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-11-08 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-11-08 10:32 -------
> "Two dummy arguments are distinguishable if neither is a subroutine and
> neither is TKR compatible (5.1.1.2) with the other."
> 
> Does this mean, though, that a subroutine is or is not distinguishable from a
> variable?

This indeed means that for (checking) generic interfaces, a subroutine dummy is
not distinguishable from a variable or function dummy. (And for distinguishing
variables/functions dummies only TKR is used.)

See also
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/18873113b18cd5e9/
and there especially the (first) posts of Craig Dedo and Richard Maine.


-- 


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


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
  2007-11-06 14:16 [Bug fortran/34004] New: Accepts invalid: Ambigiuous interface with subroutine burnus at gcc dot gnu dot org
  2007-11-07 11:02 ` [Bug fortran/34004] " pault at gcc dot gnu dot org
  2007-11-08 10:33 ` burnus at gcc dot gnu dot org
@ 2007-12-14 12:33 ` burnus at gcc dot gnu dot org
  2008-04-17  7:31 ` fxcoudert at gcc dot gnu dot org
  2008-04-20  7:31 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-14 12:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-12-14 12:33 -------
Related bug: PR 20896 (esp. test case in PR 20896 comment 0).


-- 


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


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
  2007-11-06 14:16 [Bug fortran/34004] New: Accepts invalid: Ambigiuous interface with subroutine burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-12-14 12:33 ` burnus at gcc dot gnu dot org
@ 2008-04-17  7:31 ` fxcoudert at gcc dot gnu dot org
  2008-04-20  7:31 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-04-17  7:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2008-04-17 07:30 -------
More talk about that recently:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/ff402a68a17d2be9/543de4c347caa9d0

This is well described in the last example of C.11.2.


-- 

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         |2008-04-17 07:30:31
               date|                            |


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


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
  2007-11-06 14:16 [Bug fortran/34004] New: Accepts invalid: Ambigiuous interface with subroutine burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-04-17  7:31 ` fxcoudert at gcc dot gnu dot org
@ 2008-04-20  7:31 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-04-20  7:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2008-04-20 07:31 -------
Note: Fortran 2008 is better in this regard:

http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/ff402a68a17d2be9

Here is the relevant text from the current draft, 08-007r2.
Reference is sec. 12.4.3.4.5, par. 3.
[Begin quote]
Two dummy arguments are distinguishable if:
* One is a procedure and the other is a data object,
[End of quote] 


-- 


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


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
       [not found] <bug-34004-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2013-04-30 21:48 ` tkoenig at gcc dot gnu.org
@ 2013-04-30 21:48 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-04-30 21:48 UTC (permalink / raw)
  To: gcc-bugs


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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |tkoenig at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #10 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-04-30 21:48:03 UTC ---
Fixed. closing.


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
       [not found] <bug-34004-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-04-28 17:14 ` dominiq at lps dot ens.fr
@ 2013-04-30 21:48 ` tkoenig at gcc dot gnu.org
  2013-04-30 21:48 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-04-30 21:48 UTC (permalink / raw)
  To: gcc-bugs


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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
         Resolution|FIXED                       |

--- Comment #11 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-04-30 21:48:28 UTC ---
Oopw, wrong PR.


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
       [not found] <bug-34004-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-04-28 16:00 ` janus at gcc dot gnu.org
@ 2013-04-28 17:14 ` dominiq at lps dot ens.fr
  2013-04-30 21:48 ` tkoenig at gcc dot gnu.org
  2013-04-30 21:48 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 12+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-04-28 17:14 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #9 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-04-28 17:14:05 UTC ---
> "Two dummy arguments are distinguishable if neither is a subroutine and neither
> is TKR compatible (5.1.1.2) with the other."

AFAICT this is not a constraint on the compiler to diagnose it.

> How about counting this as a "bug in the F03 standard" and closing the PR as
> invalid (as suggested by Mikael)?

If nobody want to do the changes for a diagnostic under -std=f95/f2003, I think
it should be closed as WONTFIX to better reflect the situation.


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
       [not found] <bug-34004-4@http.gcc.gnu.org/bugzilla/>
  2012-08-12 11:22 ` mikael at gcc dot gnu.org
  2012-08-12 12:52 ` burnus at gcc dot gnu.org
@ 2013-04-28 16:00 ` janus at gcc dot gnu.org
  2013-04-28 17:14 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: janus at gcc dot gnu.org @ 2013-04-28 16:00 UTC (permalink / raw)
  To: gcc-bugs


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu.org

--- Comment #8 from janus at gcc dot gnu.org 2013-04-28 16:00:48 UTC ---
(In reply to comment #7)
> > The test in comment #0 is accepted and outputs:
> > $  ./comment_0
> >            1
> >            2
> > $
> > 
> > Which seems sensible to me.
> 
> Well the program in comment 0 is invalid in Fortran 2003 but valid in Fortran
> 2008 (cf. quotes in comment 0 and comment 5.)
> 
> Thus, we should reject it with -std=f95/f2003 and accept it with -std=f2008 and
> later. (Cf. PR 45521)

Since F08 allows it and the two interfaces in comment 0 are distinguishable by
"common sense", I would say it's not worth to implement any diagnostics for it.
How about counting this as a "bug in the F03 standard" and closing the PR as
invalid (as suggested by Mikael)?


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
       [not found] <bug-34004-4@http.gcc.gnu.org/bugzilla/>
  2012-08-12 11:22 ` mikael at gcc dot gnu.org
@ 2012-08-12 12:52 ` burnus at gcc dot gnu.org
  2013-04-28 16:00 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-08-12 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-12 12:52:42 UTC ---
(In reply to comment #6)
> The test in comment #0 is accepted and outputs:
> $  ./comment_0
>            1
>            2
> $
> 
> Which seems sensible to me.

Well the program in comment 0 is invalid in Fortran 2003 but valid in Fortran
2008 (cf. quotes in comment 0 and comment 5.)

Thus, we should reject it with -std=f95/f2003 and accept it with -std=f2008 and
later. (Cf. PR 45521)


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

* [Bug fortran/34004] Accepts invalid: Ambigiuous interface with subroutine.
       [not found] <bug-34004-4@http.gcc.gnu.org/bugzilla/>
@ 2012-08-12 11:22 ` mikael at gcc dot gnu.org
  2012-08-12 12:52 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-08-12 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #6 from Mikael Morin <mikael at gcc dot gnu.org> 2012-08-12 11:22:39 UTC ---
The test in comment #0 is accepted and outputs:

$  ./comment_0
           1
           2
$

Which seems sensible to me.
Close as INVALID?


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

end of thread, other threads:[~2013-04-30 21:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-06 14:16 [Bug fortran/34004] New: Accepts invalid: Ambigiuous interface with subroutine burnus at gcc dot gnu dot org
2007-11-07 11:02 ` [Bug fortran/34004] " pault at gcc dot gnu dot org
2007-11-08 10:33 ` burnus at gcc dot gnu dot org
2007-12-14 12:33 ` burnus at gcc dot gnu dot org
2008-04-17  7:31 ` fxcoudert at gcc dot gnu dot org
2008-04-20  7:31 ` burnus at gcc dot gnu dot org
     [not found] <bug-34004-4@http.gcc.gnu.org/bugzilla/>
2012-08-12 11:22 ` mikael at gcc dot gnu.org
2012-08-12 12:52 ` burnus at gcc dot gnu.org
2013-04-28 16:00 ` janus at gcc dot gnu.org
2013-04-28 17:14 ` dominiq at lps dot ens.fr
2013-04-30 21:48 ` tkoenig at gcc dot gnu.org
2013-04-30 21:48 ` tkoenig at gcc dot gnu.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).