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

             Bug #: 50659
           Summary: ICE on invalid with procedure interface
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: aben...@caltech.edu


:: arrSize
end module Size_Mod

module Test_Mod
!  use Size_Mod !! Works if module used here.
  implicit none
  private
  public :: Init, Proc1

contains

  subroutine Init(Proc_Get)
    implicit none
    procedure(Proc1), pointer, intent(inout) :: Proc_Get

    return
  end subroutine Init

  function Proc1(arg1) result (res)
    use Size_Mod !! Fails if module used here.
    implicit none
    double precision, dimension(arrSize) :: res
    double precision, intent(in) :: arg1

    return
  end function Proc1

end module Test_Mod

$ gfortran -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc-4.7/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.7/libexec/gcc/i686-pc-linux-
gnu/4.7.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.7/configure --prefix=/usr/local/gcc-4.7 --enable-
languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.7.0 20111007 (experimental) (GCC)

$ gfortran -c test.F90 -o test.o
f951: internal compiler error: in replace_symbol, at fortran/expr.c:4155
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The code is presumably invalid, because the "arrSize" variable (defined in 
Size_Mod) isn't in scope where Proc1 is used as a procedure interface - moving 
the "use Size_Mod" so that "arrSize" is in scope throughout the "Test_Mod" 
module makes the ICE go away.

The ICE also seems to occur in 4.6.1.

Interestingly, 4.4.5 compiles without complaint, unless I remove "Proc1" from 
the "public" statement in which case it instead complains "Error: Interface 
'proc1' of procedure 'proc_get' at (1) must be explicit". My understanding is 
that Proc1 should have an explicit interface as it's in a module.

Reply via email to