Reported by bd satish at http://gcc.gnu.org/ml/fortran/2010-07/msg00206.html

The following program segfaults. The crucial part is that the argument has is
CLASS and not TYPE - and that it is used in a specification expression.

The ICE occurs when it is written to the .MOD file.


Valgrind shows:

==15819== Invalid read of size 8
==15819==    at 0x50E636: mio_expr (module.c:3091)
==15819==    by 0x50F0C9: mio_array_spec (module.c:2179)
==15819==    by 0x50F208: mio_component (module.c:2371)
==15819==    by 0x50F3E7: mio_symbol (module.c:2420)
==15819==    by 0x50F82A: write_symbol (module.c:4804)
==15819==    by 0x510CE5: write_symbol0 (module.c:4844)
==15819==    by 0x51132B: gfc_dump_module (module.c:5022)
==15819==    by 0x51BFE0: gfc_parse_file (parse.c:4388)


module array
  type :: t_array
     real, dimension(10) :: coeff
   contains
     procedure, nopass :: get_coeff
  end type t_array
contains
  function get_coeff(self) result(coeff)
    class(t_array), intent(in) :: self
    real, dimension(5) :: coeff
    i = size(self%coeff)
  end function get_coeff
end module array


-- 
           Summary: [OOP] ICE with specification expression SIZE(<CLASS>)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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

Reply via email to