https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108680
--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- The check is being done in interface.cc. The kind is being checked against default_integer_kind. case(2): /* UNIT */ type = BT_INTEGER; kind = gfc_default_integer_kind; intent = INTENT_IN; check_dtio_arg_TKR_intent (fsym, typebound, type, kind, 0, intent); break; case(3): /* IOTYPE */ type = BT_CHARACTER; kind = gfc_default_character_kind; intent = INTENT_IN; check_dtio_arg_TKR_intent (fsym, typebound, type, kind, 0, intent); break; I believe they are correct. Going back to my example: --- subroutine write_formatted (this, unit, iotype, v_list, iostat, iomsg) class(dtype), intent(in) :: this integer(8), intent(in) :: unit, v_list(:) --- Explicitly giving the kind=8 in the interface specification violates the interface definition given in the standard. If I compile it like this, the errors go away as expected. $ gfc -fdefault-integer-8 pr108680.f90 jerry@r7laptop:~/dev/test/pr108680$ ./a.out At line 21 of file pr108680.f90 Fortran runtime error: Unit number in I/O statement too large In the runtime library we assume a kind=4 integer in transfer.c. case FMT_DT: if (n == 0) goto need_data; GFC_INTEGER_4 unit = dtp->u.p.current_unit->unit_number; char dt[] = "DT"; char tmp_iomsg[IOMSG_LEN] = ""; char *child_iomsg; gfc_charlen_type child_iomsg_len; GFC_INTEGER_4 noiostat; Do we need to support more units than we can specify with GFC_INTEGER_4?