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

--- Comment #5 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> 
---
The ICE with  associate_6.f03  and  -fmodule-private
depends on including "implicit none" in main program :


$ cat z3.f90
module m
  private
contains
  pure function func (n) result (f)
    integer, intent(in) :: n
    integer :: f(n)
    f = 0.0
  end function
end module

program p
  use m
  implicit none
  associate (arr => func (4))
    print *, arr(1)
  end associate
end


$ gfortran-6 -c z3.f90
z3.f90:14:20:

   associate (arr => func (4))
                    1
Error: Function 'func' at (1) has no IMPLICIT type
z3.f90:14:28:

   associate (arr => func (4))
                            1
Error: Symbol 'arr' at (1) has no IMPLICIT type
f951: internal compiler error: find_array_spec(): Missing spec

---


$ cat z3b.f90
module m
  private
contains
  pure function func (n) result (f)
    integer, intent(in) :: n
    integer :: f(n)
    f = 0.0
  end function
end module

program p
  use m
! implicit none
  associate (arr => func (4))
    print *, arr(1)
  end associate
end


$ gfortran-6 -c z3b.f90
z3b.f90:14:28:

   associate (arr => func (4))
                            1
Error: Associate-name 'arr' at (1) is used as array

Reply via email to