[Bug fortran/78719] ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1438

2016-12-07 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78719

--- Comment #2 from Gerhard Steinmetz  
---

Interestingly, following invalid variant with "type(t)"
is silently accepted and gives same results as z0.f90 in comment 1.


$ cat z2.f90
program p
   type t
  integer :: n
   end type
   type(t) :: 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 z2.f90
$ a.out
 inside f
 inside g

[Bug fortran/78719] ICE in gfc_get_symbol_decl, at fortran/trans-decl.c:1438

2016-12-07 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78719

--- Comment #1 from Gerhard Steinmetz  
---

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