public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40443]  New: Elemental procedure in genericl interface incorrectly selected in preference to specific procedure
@ 2009-06-15  1:16 ian_harvey at bigpond dot com
  2009-06-15  7:46 ` [Bug fortran/40443] " burnus at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: ian_harvey at bigpond dot com @ 2009-06-15  1:16 UTC (permalink / raw)
  To: gcc-bugs

F95 standard section 14.1.2.4.1 (particular Note 14.6) implies to me that when
an elemental and a non-elemental specific procedure in a generic interface both
"match" a reference, it is the specific instance that should be selected.

The reference selected by gfortran appears to depend on the ordering of
procedures in the generic interface block.  I'd expect the last line of output
from the following to be "S, S" as a result of selecting the specific procedure
"SpecProc".  I get "E, E" which has come from the elemental procedure.


MODULE SomeOptions
  IMPLICIT NONE  
  INTERFACE ElemSpec
    MODULE PROCEDURE ElemProc
    MODULE PROCEDURE SpecProc
  END INTERFACE ElemSpec  
  INTERFACE SpecElem
    MODULE PROCEDURE SpecProc
    MODULE PROCEDURE ElemProc
  END INTERFACE SpecElem
CONTAINS
  ELEMENTAL SUBROUTINE ElemProc(a)  
    CHARACTER, INTENT(OUT) :: a
    !****
    a = 'E'            
  END SUBROUTINE ElemProc

  SUBROUTINE SpecProc(a)  
    CHARACTER, INTENT(OUT) :: a(:)
    !****    
    a = 'S'    
  END SUBROUTINE SpecProc
END MODULE SomeOptions

PROGRAM MakeAChoice
  USE SomeOptions  
  IMPLICIT NONE
  CHARACTER scalar, array(2)    
  !****
  CALL ElemSpec(scalar) ! Should choose the elemental (and does)
  WRITE (*, 100) scalar
  CALL ElemSpec(array)  ! Should choose the specific (and does)
  WRITE (*, 100) array
  !----
  CALL SpecElem(scalar) ! Should choose the elemental (and does)
  WRITE (*, 100) scalar
  CALL SpecElem(array)  ! Should choose the specific (but doesn't)
  WRITE (*, 100) array  
  !----
  100 FORMAT(A,:,', ',A)
END PROGRAM MakeAChoice


>gfortran --version
GNU Fortran (GCC) 4.5.0 20090421 (experimental) [trunk revision 146519]


-- 
           Summary: Elemental procedure in genericl interface incorrectly
                    selected in preference to specific procedure
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian_harvey at bigpond dot com
 GCC build triplet: i586-pc-mingw32
  GCC host triplet: i586-pc-mingw32
GCC target triplet: i586-pc-mingw32


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


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

end of thread, other threads:[~2009-06-29 16:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-15  1:16 [Bug fortran/40443] New: Elemental procedure in genericl interface incorrectly selected in preference to specific procedure ian_harvey at bigpond dot com
2009-06-15  7:46 ` [Bug fortran/40443] " burnus at gcc dot gnu dot org
2009-06-15  8:28 ` jpr at csc dot fi
2009-06-15 11:24 ` burnus at gcc dot gnu dot org
2009-06-15 13:21 ` pault at gcc dot gnu dot org
2009-06-17 13:04 ` dominiq at lps dot ens dot fr
2009-06-21  7:42 ` pault at gcc dot gnu dot org
2009-06-22  4:41 ` pault at gcc dot gnu dot org
2009-06-22  4:42 ` pault at gcc dot gnu dot org
2009-06-29  7:49 ` burnus at gcc dot gnu dot org
2009-06-29  9:23 ` pault at gcc dot gnu dot org
2009-06-29 16:45 ` pault at gcc dot gnu dot org
2009-06-29 16:46 ` 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).