[Bug fortran/58557] [OOP] Issues with CLASS/TYPE functions in array constructors: reject valid, memory leaks, invalid free

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 5 13:39:00 GMT 2014


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |ice-on-valid-code

--- Comment #3 from janus at gcc dot gnu.org ---
Here is a 'corrected' version of the test case:

program main
  implicit none

   type t
   end type t

  interface
    function f_type()
      import :: t
      type(t), allocatable :: f_type
    end function
    function f_type_na()
      import :: t
      type(t) :: f_type_na
    end function
    function f_type_array()
      import :: t
      type(t), allocatable :: f_type_array(:)
    end function
    function f_type_array_na()
      import :: t
      type(t) :: f_type_array_na(5)
    end function
    function f_class(i)
      import :: t
      class(t), allocatable :: f_class
      integer :: i
    end function
    function f_class_array(i)
      import :: t
      class(t), allocatable :: f_class_array(:)
      integer :: i
    end function
    subroutine sub_type2(x)
      import :: t
      type(t) :: x(:)
    end subroutine
    subroutine sub_class2(x)
      import :: t
      class(t) :: x(:)
    end subroutine
  end interface

  type(t) :: b(1)
  integer :: i

  b = [ f_type() ]
  b = [ f_type_na() ]
  b = [ f_type_array() ]
  b = [ f_type_array_na() ]
  b = [ f_class_array(1) ]
  call sub_type2([f_class(1)])
  call sub_type2([f_class_array(1)])
  call sub_type2([(f_class(i),i=1,5)])
  call sub_type2([(f_class_array(i),i=1,5)])
  call sub_class2([f_class(1)])
  call sub_class2([f_class_array(1)])
  call sub_class2([(f_class(i),i=1,5)])
  call sub_class2([(f_class_array(i),i=1,5)])
end program main


which yields with 4.9 trunk:

c0.f90:51:0: internal compiler error: in gfc_trans_array_constructor_subarray,
at fortran/trans-array.c:1472
   b = [ f_class_array(1) ]
 ^
0x63078f gfc_trans_array_constructor_subarray
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:1472
0x63078f gfc_trans_array_constructor_value
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:1601
0x62f216 trans_array_constructor
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:2323
0x62f216 gfc_add_loop_ss_code
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:2558
0x62f955 gfc_conv_loop_setup(gfc_loopinfo*, locus*)
    /home/jweil/gcc49/trunk/gcc/fortran/trans-array.c:4683
0x64c001 gfc_trans_assignment_1
    /home/jweil/gcc49/trunk/gcc/fortran/trans-expr.c:7913
0x61e795 trans_code
    /home/jweil/gcc49/trunk/gcc/fortran/trans.c:1623
0x63dee2 gfc_generate_function_code(gfc_namespace*)
    /home/jweil/gcc49/trunk/gcc/fortran/trans-decl.c:5605
0x5de510 translate_all_program_units
    /home/jweil/gcc49/trunk/gcc/fortran/parse.c:4536
0x5de510 gfc_parse_file()
    /home/jweil/gcc49/trunk/gcc/fortran/parse.c:4733
0x61adb5 gfc_be_parse_file
    /home/jweil/gcc49/trunk/gcc/fortran/f95-lang.c:188
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.



More information about the Gcc-bugs mailing list