The following program is rejected with NAG/ifort/g95 with:

error #6382: The result of an evaluation of an output item list must not be of
a derived type that ultimately contains a pointer component.

ERROR: Data transfer element at (1) cannot have POINTER components

ERROR: Derived type T in io-list has POINTER component NODENAME

gfortran crashes in trans-io.c


module inputdom
  type t
    private
    character, pointer, dimension(:)         :: nodeName => null()
  end type t
contains
  subroutine getstructinput()
    implicit none
    print *, (foo()) ! <------ ICE here!
  end subroutine
  function foo()
    type(t), pointer :: foo
    foo => null()
  end function foo
end module inputdom


==16927== Invalid read of size 4
==16927==    at 0xD25BE4: __gmpz_sub (aors.h:65)
==16927==    by 0x56C5DE: transfer_array_component (trans-io.c:1947)
==16927==    by 0x56C988: transfer_expr (trans-io.c:2108)


#1  0x000000000056c5df in transfer_array_component (expr=<value optimized out>,
cm=0x149a910, where=<value optimized out>)
    at /home/tob/projects/gcc-trunk-checkout/gcc/fortran/trans-io.c:1947
#2  0x000000000056c989 in transfer_expr (se=0x7fffffffd250, ts=<value optimized
out>, addr_expr=<value optimized out>, code=0x149d5f0)
    at /home/tob/projects/gcc-trunk-checkout/gcc/fortran/trans-io.c:2108
#3  0x000000000057077b in gfc_trans_transfer (code=0x149d5f0) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/trans-io.c:2244
#4  0x000000000053be88 in gfc_trans_code (code=0x149d5f0) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/trans.c:1250
#5  0x000000000056e7a8 in build_dt (function=<value optimized out>, code=<value
optimized out>)
    at /home/tob/projects/gcc-trunk-checkout/gcc/fortran/trans-io.c:1814


-- 
           Summary: ICE on invalid expression involving DT with pointer
                    components in I/O
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-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=41859

Reply via email to