https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108680
Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |WAITING Severity|normal |enhancement --- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- I just circled back on this one. If I modify the test case to explicitly define the interface to use integer(8) like this: module types type dtype contains procedure :: write_formatted generic, public :: write(formatted) => write_formatted end type contains subroutine write_formatted (this, unit, iotype, v_list, iostat, iomsg) class(dtype), intent(in) :: this integer(8), intent(in) :: unit, v_list(:) character(*), intent(in) :: iotype integer, intent(out) :: iostat character(*), intent(inout) :: iomsg iostat = 0 write(unit,*) 'v_list', v_list end subroutine write_formatted end module types program p use types, only: dtype type(dtype) :: data integer :: u open (file = 'output.txt', newunit = u, form = 'formatted') write (u, '(dt(1,2,3))') data close (u) end program p We get the following: $ gfc pr108680.f90 pr108680.f90:11:43: 11 | subroutine write_formatted (this, unit, iotype, v_list, iostat, iomsg) | 1~~~ Error: DTIO dummy argument at (1) must be of KIND = 4 pr108680.f90:11:57: 11 | subroutine write_formatted (this, unit, iotype, v_list, iostat, iomsg) | 1~~~~~ Error: DTIO dummy argument at (1) must be of KIND = 4 pr108680.f90:30:13: 30 | use types, only: dtype | 1 Fatal Error: Cannot open module file ‘types.mod’ for reading at (1): No such file or directory compilation terminated. We chose to restrict this. Now if you check the standard, the interface is defined as SUBROUTINE my_write_routine_formatted (dtv, unit, iotype, v_list, iostat, iomsg) ! the derived-type value/variable dtv-type-spec , INTENT(IN) :: dtv INTEGER, INTENT(IN) :: unit ! the edit descriptor string CHARACTER (LEN=*), INTENT(IN) :: iotype INTEGER, INTENT(IN) :: v_list(:) INTEGER, INTENT(OUT) :: iostat CHARACTER (LEN=*), INTENT(INOUT) :: iomsg END Indeed, the unit is defined as default integer, which for gfortran is kind=4. The option -fdefault-integer=8 is an extension falling outside the Fortran Standards so the test case is in a sense invalid. I will change this to an ENHANCEMENT and not really a bug. I think we could outright reject it as invalid.