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

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> 2012-08-18 
21:56:02 UTC ---
(In reply to comment #3)
> Thus, I concur that it seems to be fixed. However, one could consider to
> include the two test cases of the IR in the testsuite - besides the invalid 
> one
> of comment 0, the valid one of question 2 (see IR).

Actually, the valid test doesn't work as `qc' instead of `qr' is called in the
first call. Testcase:

! { dg-do run }
!
! PR fortran/39290
! Subroutine/function ambiguity in generics.
!
     function ff()
       ff = 4
     end function ff

     function cc()
       cc = (5,6)
     end function cc

     subroutine qr(f)
       real, external :: f
       complex c
       common /a/ r, c
       r = f() 
     end subroutine

     subroutine qc(f)
       complex, external :: f
       complex c
       common /a/ r, c
       c = f()
     end subroutine

     module m
       interface q
         subroutine qr(f)
           real, external :: f
         end subroutine
         subroutine qc(f)
           complex, external :: f
         end subroutine
       end interface q
     end module m

     program main
       use m
       external ff, cc
       complex cc, c
       common /a/ r, c
       r = 1
       c = (2, 3)
       call q(ff)
       !print *, r
       if (r /=  4   ) call abort
       !print *, c
       if (c /= (2,3)) call abort
       call q(cc)
       !print *, r
       if (r /=  4   ) call abort
       !print *, c
       if (c /= (5,6)) call abort
     end

Reply via email to