public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30068]  New: Ambigous interfaces not detected
@ 2006-12-04 21:12 burnus at gcc dot gnu dot org
  2006-12-04 22:47 ` [Bug fortran/30068] " pault at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-12-04 21:12 UTC (permalink / raw)
  To: gcc-bugs

Examples taken from the Fortran 2003 standard, Section C.11.2.
They are not recognized as invalid.

 * * *

INTERFACE BAD8 ! this interface is invalid !
  ! despite the fact that it is unambiguous !
  SUBROUTINE S8A(X,Y,Z)
    REAL,OPTIONAL :: X
    INTEGER :: Y
    REAL :: Z
  END SUBROUTINE S8A
  SUBROUTINE S8B(X,Z,Y)
    INTEGER,OPTIONAL :: X
    INTEGER :: Z
    REAL :: Y
  END SUBROUTINE S8B
END INTERFACE BAD8

This interface fails rule (3) because there are no required arguments that can
be distinguished from the positionally corresponding argument, but in order for
the mismatch of the optional arguments not to be relevant, the later arguments
must be specified as keyword arguments, so distinguishing by name does the
trick. This interface is nevertheless invalid so a standard-conforming Fortran
processor is not required to do such reasoning. The rules to cover all cases
are too complicated to be useful.

 * * *

module x
  INTERFACE BAD9 ! this interface is invalid !
  ! despite the fact that it is unambiguous !
    SUBROUTINE S9A(X)
      REAL :: X
    END SUBROUTINE S9A
    SUBROUTINE S9B(X)
      INTERFACE
        FUNCTION X(A)
          REAL :: X,A
        END FUNCTION X
      END INTERFACE
    END SUBROUTINE S9B
    SUBROUTINE S9C(X)
      INTERFACE
        FUNCTION X(A)
          REAL :: X
          INTEGER :: A
        END FUNCTION X
      END INTERFACE
    END SUBROUTINE S9C
  END INTERFACE BAD9
end module x

The real data objects that would be valid arguments for S9A are entirely
disjoint from procedures that are valid arguments to S9B and S9C, and the
procedures that valid arguments for S9B are disjoint from the procedures that
are valid arguments to S9C because the former are required to accept real
arguments and the latter integer arguments. Again, this interface is invalid,
so a standard-conforming Fortran processor need not examine such properties
when deciding whether a generic collection is valid. Again, the rules to cover
all cases are too complicated to be useful.


-- 
           Summary: Ambigous interfaces not detected
           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=30068


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

end of thread, other threads:[~2006-12-21 15:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-04 21:12 [Bug fortran/30068] New: Ambigous interfaces not detected burnus at gcc dot gnu dot org
2006-12-04 22:47 ` [Bug fortran/30068] " pault at gcc dot gnu dot org
2006-12-05 21:15 ` pault at gcc dot gnu dot org
2006-12-05 22:02 ` pault at gcc dot gnu dot org
2006-12-05 22:52 ` pault at gcc dot gnu dot org
2006-12-06  7:24 ` burnus at gcc dot gnu dot org
2006-12-06 18:50 ` pault at gcc dot gnu dot org
2006-12-06 21:30 ` burnus at gcc dot gnu dot org
2006-12-06 23:08 ` paulthomas2 at wanadoo dot fr
2006-12-07 17:25 ` pault at gcc dot gnu dot org
2006-12-07 20:22 ` burnus at gcc dot gnu dot org
2006-12-07 23:34 ` paulthomas2 at wanadoo dot fr
2006-12-08 21:00 ` pault at gcc dot gnu dot org
2006-12-09  0:54 ` burnus at gcc dot gnu dot org
2006-12-09 21:14 ` pault at gcc dot gnu dot org
2006-12-21 15:06 ` [Bug fortran/30068] [4.1 and 4.2 only] " pault at gcc dot gnu dot org
2006-12-21 15:07 ` [Bug fortran/30068] [4.1 " pault 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).