https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78848
Bug ID: 78848 Summary: [OOP] ICE on writing CLASS variable with non-typebound DTIO procedure Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: janus at gcc dot gnu.org Target Milestone: --- Here is a variant of a testcase posted by Mikael at https://gcc.gnu.org/ml/fortran/2016-12/msg00232.html: module m type :: t contains ! procedure :: wf ! generic :: write(formatted) => wf end type interface write(formatted) procedure wf end interface contains subroutine wf(this, a, b, c, d, e) class(t), intent(in) :: this integer, intent(in) :: a character, intent(in) :: b integer, intent(in) :: c(:) integer, intent(out) :: d character, intent(inout) :: e end subroutine end program p use m class(t), allocatable :: z allocate(z) print *, z end I assume this is valid code, but it results in an ICE: f951: internal compiler error: Bad IO basetype (7) 0x7949b3 gfc_internal_error(char const*, ...) /home/jweil/gcc/trunk/gcc/fortran/error.c:1346 0x9128fa transfer_expr /home/jweil/gcc/trunk/gcc/fortran/trans-io.c:2429 Note that the ICE goes away when using the typebound version of the DTIO procedure (commented out in the above example).