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



janus at gcc dot gnu.org changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |janus at gcc dot gnu.org



--- Comment #6 from janus at gcc dot gnu.org 2013-04-28 18:35:43 UTC ---

(In reply to comment #4)

> Actually, the valid test doesn't work as `qc' instead of `qr' is called in the

> first call.



It *does* work if one explicitly declares 'ff' as real (and fixes the

implementation of 'cc' to be complex):





function ff()

  ff = 4

end function ff



complex 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

  real ff

  common /a/ r, c

  r = 1

  c = (2, 3)

  call q(ff)

  !print *, r, c

  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 





I absolutely *never* use implicit declarations, therefore I'm not sure: Is an

"external ff" declaration supposed to get implicitly typed as real in comment

4? If yes, then it's apparently a bug that we don't do this ...

Reply via email to