public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39876]  New: module procedure name that collides with the GNU intrinsic
@ 2009-04-23 21:00 alexei dot matveev+gcc at gmail dot com
  2009-04-23 21:19 ` [Bug fortran/39876] " kargl at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: alexei dot matveev+gcc at gmail dot com @ 2009-04-23 21:00 UTC (permalink / raw)
  To: gcc-bugs

Using module procedure names that collide with the GNU intrinsic extensions
is not possible even with -std=f95:

alexei@novo:~/$ gfortran -c -std=f95 p.f90
p.f90:19.19:

      print *, avg(erfc)
                  1
Error: Intrinsic 'erfc' at (1) is not allowed as an actual argument
p.f90:19.19:

      print *, avg(erfc)
                  1
Error: Type/rank mismatch in argument 'f' at (1)

================ p.f90 ================
! NO: program p -- passing internal procedures                                  
!                  as actual args is not allowed                                
module p ! -- passing module procedure IS allowed                               
  implicit none                                                                 

! call test()

  contains

    subroutine test()
      implicit none
      ! *** end of interface ***

      intrinsic sqrt
      intrinsic dsqrt

    ! print *, avg(sqrt)
      print *, avg(dsqrt)
      print *, avg(erfc)
    end subroutine test

    function avg(f) result(r)
      implicit none
      double precision :: r
      interface
        double precision function f(x)
          implicit none
          double precision, intent(in) :: x
        end function f
      end interface
      ! *** end of interface ***

      r = ( f(1.0D0) + f(2.0D0) ) / 2
    end function avg

    function erfc(x) result(r)
      implicit none
      double precision, intent(in) :: x
      double precision             :: r
      ! *** end of interface ***

      r = x
    end function erfc

end ! module/program


-- 
           Summary: module procedure name that collides with the GNU
                    intrinsic
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alexei dot matveev+gcc at gmail dot com


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


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

end of thread, other threads:[~2009-09-11 22:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23 21:00 [Bug fortran/39876] New: module procedure name that collides with the GNU intrinsic alexei dot matveev+gcc at gmail dot com
2009-04-23 21:19 ` [Bug fortran/39876] " kargl at gcc dot gnu dot org
2009-04-24  5:22 ` kargl at gcc dot gnu dot org
2009-04-24 12:32 ` dominiq at lps dot ens dot fr
2009-05-06 22:08 ` janus at gcc dot gnu dot org
2009-05-07 19:11 ` janus at gcc dot gnu dot org
2009-05-08  9:08 ` janus at gcc dot gnu dot org
2009-05-08  9:11 ` janus at gcc dot gnu dot org
2009-09-02  0:11 ` pablomme at googlemail dot com
2009-09-11 22:11 ` kargl 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).