https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84141
--- Comment #13 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- The abort comes from the I/O library. Here's a backtrace: #0 _gfortrani_internal_error (cmp=0x0, message=0x10117a80 "type_name(): Bad type") at ../../../trunk/libgfortran/runtime/error.c:410 #1 0x00000000100cf268 in _gfortrani_type_name (type=<optimized out>) at ../../../trunk/libgfortran/io/transfer.c:1218 #2 0x00000000100cf34c in require_type (dtp=dtp@entry=0x3fffffffb928, expected=expected@entry=BT_INTEGER, actual=actual@entry=BT_UNKNOWN, f=f@entry=0x10161980) at ../../../trunk/libgfortran/io/transfer.c:1269 #3 0x00000000100d2ac4 in require_type (f=0x10161980, actual=BT_UNKNOWN, expected=BT_INTEGER, dtp=<optimized out>) at ../../../trunk/libgfortran/io/transfer.c:1889 #4 formatted_transfer_scalar_write (dtp=dtp@entry=0x3fffffffb928, type=type@entry=BT_UNKNOWN, p=0x1015b680, kind=kind@entry=4, size=size@entry=0) at ../../../trunk/libgfortran/io/transfer.c:1889 #5 0x00000000100d308c in formatted_transfer (dtp=0x3fffffffb928, type=<optimized out>, p=<optimized out>, kind=<optimized out>, size=0, nelems=1) at ../../../trunk/libgfortran/io/transfer.c:2279 #6 0x00000000100cf864 in _gfortran_transfer_array (dtp=0x3fffffffb928, desc=<optimized out>, kind=<optimized out>, charlen=<optimized out>) at ../../../trunk/libgfortran/io/transfer.c:2450 What stands out is the require_type (f=0x10161980, actual=BT_UNKNOWN This can be traced to Breakpoint 1, _gfortran_transfer_array (dtp=0x3fffffffb928, desc=0x1015b438, kind=4, charlen=0) at ../../../trunk/libgfortran/io/transfer.c:2411 2411 if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK) (gdb) s 2414 iotype = (bt) GFC_DESCRIPTOR_TYPE (desc); (gdb) 2415 size = iotype == BT_CHARACTER ? (index_type) charlen : GFC_DESCRIPTOR_SIZE (desc); (gdb) p iotype $1 = BT_UNKNOWN So, in this case, the type appears to be missing from the descriptor: (gdb) p *desc $3 = {base_addr = 0x1015b680 "", offset = 18446744073709551615, dtype = {elem_len = 0, version = 0, rank = 0 '\000', type = 0 '\000', attribute = 0}, span = 269743360, dim = {{_stride = 1, lower_bound = 1, _ubound = 1}, {_stride = 269858464, lower_bound = -1, _ubound = 0}, {_stride = 0, lower_bound = 2, _ubound = 1}, {_stride = 1, lower_bound = 1, _ubound = 4294967298}, {_stride = 269858496, lower_bound = -1, _ubound = 0}, { _stride = 0, lower_bound = 269743360, _ubound = 1}, {_stride = 1, lower_bound = 1, _ubound = 269858528}, {_stride = -1, lower_bound = 0, _ubound = 0}, {_stride = 2, lower_bound = 1, _ubound = 1}, {_stride = 1, lower_bound = 8589934593, _ubound = 269858560}, {_stride = -1, lower_bound = 0, _ubound = 0}, {_stride = 269743360, lower_bound = 1, _ubound = 1}, {_stride = 1, lower_bound = 269858592, _ubound = -1}, { _stride = 0, lower_bound = 0, _ubound = 2}, {_stride = 1, lower_bound = 1, _ubound = 1}}} The offending line of the program is (gdb) p *dtp $4 = {common = {flags = 4096, unit = 12, filename = 0x10112b50 "vamp.f90", line = 132, The line is write (u, "(5x,A,99(1x,I0))") "Permutation:", eq%permutation which gets translated, in the *.original dump, to [vamp.f90:132:0] { [vamp.f90:132:0] [vamp.f90:132:0] [vamp.f90:132:0] dt_parm.54.common.filename = [vamp.f90:132:0] &[vamp.f90:132:0] "vamp.f90"[1]{lb: 1 sz: 1}; [vamp.f90:132:0] [vamp.f90:132:0] [vamp.f90:132:0] dt_parm.54.common.line = 132; [vamp.f90:132:0] [vamp.f90:132:0] dt_parm.54.format = [vamp.f90:132:0] &[vamp.f90:132:0] "(5x,A,99(1x,I0))"[1]{lb: 1 sz: 1}; [vamp.f90:132:0] [vamp.f90:132:0] dt_parm.54.format_len = 16; [vamp.f90:132:0] [vamp.f90:132:0] [vamp.f90:132:0] dt_parm.54.common.flags = 4096; [vamp.f90:132:0] [vamp.f90:132:0] [vamp.f90:132:0] dt_parm.54.common.unit = u; _gfortran_st_write ([vamp.f90:132:0] &dt_parm.54); [vamp.f90:132:0] _gfortran_transfer_character_write ([vamp.f90:132:0] &dt_parm.54, [vamp.f90:132:0] &[vamp.f90:132:0] "Permutation:"[1]{lb: 1 sz: 1}, 12); [vamp.f90:132:0] _gfortran_transfer_array_write ([vamp.f90:132:0] &dt_parm.54, [vamp.f90:132:0] &[vamp.f90:132:0] eq->permutation, 4, 0); [vamp.f90:132:0] _gfortran_st_write_done ([vamp.f90:132:0] &dt_parm.54); where eq is subroutine vamp_equivalence_write (eq, unit) integer, intent(in), optional :: unit integer :: u type(vamp_equivalence_t), intent(in) :: eq type, public :: vamp_equivalences_t type(vamp_equivalence_t), dimension(:), allocatable :: eq integer :: n_eq, n_ch integer, dimension(:), allocatable :: pointer logical, dimension(:), allocatable :: independent integer, dimension(:), allocatable :: equivalent_to_ch integer, dimension(:), allocatable :: multiplicity integer, dimension(:), allocatable :: symmetry logical, dimension(:,:), allocatable :: div_is_invariant end type vamp_equivalences_t which is called via subroutine vamp_equivalences_write (eq, unit) type(vamp_equivalences_t), intent(in) :: eq ... if (allocated (eq%eq)) then do i=1, size (eq%eq) call vamp_equivalence_write (eq%eq(i), u) end do else So, my guess would be that somewhere, a descriptor to an allocatable is not being set correctly.