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

            Bug ID: 66366
           Summary: ICE on invalid with non-allocatable CLASS variable
                    [OOP]
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abensonca at gmail dot com
  Target Milestone: ---

The following invalid code causes an ICE with gfortran 6.0.0 223992:

module bug

  type :: t1d
   contains
     procedure :: interpolate => interp
  end type t1d

  type :: tff
     class(t1d) :: transfer
  end type tff

contains

  double precision function interp(self)
    implicit none
    class(t1d), intent(inout) :: self
    return
  end function interp

  double precision function fvb(self)
    implicit none
    class(tff), intent(inout) :: self
    fvb=self%transfer%interpolate()
    return
  end function fvb

end module bug

$ gfortran -v                                                                  
                              Using built-in specs.
COLLECT_GCC=/opt/gcc-trunk/bin/gfortran
COLLECT_LTO_WRAPPER=/opt/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/opt/gcc-trunk
--enable-languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 6.0.0 20150517 (experimental) (GCC) 


 gfortran -c bug.F90 -o bug.o
bug.F90:9:27:

      class(t1d) :: transfer
                            1
Error: Component ‘transfer’ with CLASS at (1) must be allocatable or pointer
f951: internal compiler error: in check_typebound_baseobject, at
fortran/resolve.c:5521
0x637465 check_typebound_baseobject
        ../../gcc-trunk/gcc/fortran/resolve.c:5521
0x63791e resolve_compcall
        ../../gcc-trunk/gcc/fortran/resolve.c:5812
0x63404e resolve_typebound_function
        ../../gcc-trunk/gcc/fortran/resolve.c:5954
0x63404e gfc_resolve_expr(gfc_expr*)
        ../../gcc-trunk/gcc/fortran/resolve.c:6265
0x63a8b6 gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:10095
0x63d2d2 resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:15055
0x63d1d7 resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:15040
0x63d3b2 gfc_resolve(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/resolve.c:15083
0x628cb6 gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:5477
0x669445 gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.c:228
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


The code is invalid as the CLASS variable in "tff" is neither allocatable nor a
pointer. The call to the "interpolate" function of the "t1d" class seems to be
necessary to trigger the ICE.

Reply via email to