https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78719

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> 
---

Detected with type "real" instead of "class(t)" :


$ cat z3.f90
program p
   type t
      integer :: n
   end type
   real :: g   !!
   abstract interface
      subroutine h
      end
   end interface
   procedure(h), pointer :: s
   s => f
   call s
   s => g
   call s
contains
   subroutine f
      print *, 'inside f'
   end
   subroutine g
      print *, 'inside g'
   end
end


$ gfortran-7-20161204 z3.f90
z3.f90:19:15:

z3.f90:5:12:

    real :: g   !!
            2
z3.f90:19:15:

    subroutine g
               1
Error: Procedure 'g' at (1) has an explicit interface and must not have
attributes declared at (2)


---


Deleting that extra line gives a valid and correct program :


$ cat z0.f90
program p
   type t
      integer :: n
   end type
   abstract interface
      subroutine h
      end
   end interface
   procedure(h), pointer :: s
   s => f
   call s
   s => g
   call s
contains
   subroutine f
      print *, 'inside f'
   end
   subroutine g
      print *, 'inside g'
   end
end


$ gfortran-7-20161204 z0.f90
$ a.out
 inside f
 inside g

Reply via email to