public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42418]  New: PROCEDURE: Rejects interfface which is both specific and generic procedure
@ 2009-12-17 22:51 burnus at gcc dot gnu dot org
  2009-12-17 23:02 ` [Bug fortran/42418] PROCEDURE: Rejects interface " burnus at gcc dot gnu dot org
  2009-12-19 20:27 ` janus at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-12-17 22:51 UTC (permalink / raw)
  To: gcc-bugs

(found when going through the link of PR 

gfortran rejects the following program where "gen" is both a generic and a
specific procedure name as interface argument to PROCEDURE. I cannot find a
reason why it should be invalid and thus I think it is valid.


    procedure(gen) :: f
                 1
Error: Interface 'gen' at (1) may not be generic


module mod
  interface gen
    module procedure gen
  end interface gen
contains
  pure subroutine gen(a)
    integer,intent(in) :: a
  end subroutine gen
  subroutine test(f)
    procedure(gen) :: f
  end subroutine test
end module mod


-- 
           Summary: PROCEDURE: Rejects interfface which is both specific and
                    generic procedure
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          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=42418


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

* [Bug fortran/42418] PROCEDURE: Rejects interface which is both specific and generic procedure
  2009-12-17 22:51 [Bug fortran/42418] New: PROCEDURE: Rejects interfface which is both specific and generic procedure burnus at gcc dot gnu dot org
@ 2009-12-17 23:02 ` burnus at gcc dot gnu dot org
  2009-12-19 20:27 ` janus at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-12-17 23:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2009-12-17 23:02 -------
The following program is also rejected, unless the marked line is
removed/comment out. At a glance, it looks OK - and ifort, NAG f95 and g95
accept it. The error message is:


   print *, fun(enisoc, [0.0])
                1
Error: ELEMENTAL non-INTRINSIC procedure 'enisoc' is not allowed as an actual
argument at (1)


 module cos_mod
   implicit none
   interface enisoc
      module procedure element, enisoc
   end interface enisoc
   contains
      pure function enisoc(x)
         real, intent(in) :: x(:)
         real enisoc(size(x))

         enisoc = 2
      end function enisoc

      elemental function element(x)
         real, intent(in) :: x
         real element

         element = cos(x)
      end function element
end module cos_mod

program main
   use cos_mod
   implicit none
   interface
      function fun(f,x)
         implicit none
         interface
            pure function f(x)
               real, intent(in) :: x(:)
               real f(size(x))
            end function f
         end interface
         real x(:)
         real fun(size(x))
      end function fun
   end interface

   print *, enisoc(0.0)  ! <<< Works without this line
   print *, fun(enisoc, [0.0])
end program main

!function fun(f,x)
!   implicit none
!   interface
!      pure function f(x)
!         real, intent(in) :: x(:)
!         real f(size(x))
!      end function f
!   end interface
!   real x(:)
!   real fun(size(f(x)))
!
!   fun = f(x)
!end function fun


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|PROCEDURE: Rejects          |PROCEDURE: Rejects interface
                   |interfface which is both    |which is both specific and
                   |specific and generic        |generic procedure
                   |procedure                   |


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


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

* [Bug fortran/42418] PROCEDURE: Rejects interface which is both specific and generic procedure
  2009-12-17 22:51 [Bug fortran/42418] New: PROCEDURE: Rejects interfface which is both specific and generic procedure burnus at gcc dot gnu dot org
  2009-12-17 23:02 ` [Bug fortran/42418] PROCEDURE: Rejects interface " burnus at gcc dot gnu dot org
@ 2009-12-19 20:27 ` janus at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: janus at gcc dot gnu dot org @ 2009-12-19 20:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2009-12-19 20:27 -------
(In reply to comment #1)
> The following program is also rejected, unless the marked line is
> removed/comment out. At a glance, it looks OK - and ifort, NAG f95 and g95
> accept it. The error message is:
> 
> 
>    print *, fun(enisoc, [0.0])
>                 1
> Error: ELEMENTAL non-INTRINSIC procedure 'enisoc' is not allowed as an actual
> argument at (1)

This one I can not confirm. With a clean trunk at r155303 I do not see the
error message on x86_64-unknown-linux-gnu.


-- 


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


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

end of thread, other threads:[~2009-12-19 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-17 22:51 [Bug fortran/42418] New: PROCEDURE: Rejects interfface which is both specific and generic procedure burnus at gcc dot gnu dot org
2009-12-17 23:02 ` [Bug fortran/42418] PROCEDURE: Rejects interface " burnus at gcc dot gnu dot org
2009-12-19 20:27 ` janus 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).