From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 035113857034; Wed, 24 Aug 2022 07:44:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 035113857034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661327090; bh=Zmomp4gyJnxis4OyJ4CpLfGqP1EzPzsjAqe9kQ+6ZpY=; h=From:To:Subject:Date:From; b=WmVWjmpveoF8jml78ZDBT3V0OGRr0I4ZGTV0YcXFHyJW1i8mS43HnzuBdU/7lD9Tt GiobqCrKPsM9oKyxNNQwfQOp5eco/6v6gRTHS5czUofBvOjQRNea6QPShhdLs2ALqp QgzkVy71sZP8RLMcXK4YEHTv0CMxtlIYJVuDYnrE= From: "federico.perini at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/106731] New: ICE on automatic array of derived type with DTIO Date: Wed, 24 Aug 2022 07:44:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: federico.perini at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106731 Bug ID: 106731 Summary: ICE on automatic array of derived type with DTIO Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: federico.perini at gmail dot com Target Milestone: --- A derived type that has user-defined I/O causes ICE on all gfortran version= s 7 to 12.1.0, whenever it's being used as an automatic object. The error is at=20 63 | type(t) :: automatic(n) | 1 internal compiler error: in gfc_trans_auto_array_allocation, at fortran/trans-array.cc:6617 This does not happen if the derived type is allocated. Here's the simplest example:=20 module causes_ice implicit none type :: t real(8) :: x contains procedure, private :: write_formatted generic :: write(formatted) =3D> write_formatted end type t contains subroutine write_formatted(this, unit, iotype, v_list, iostat, iomsg) class(t), intent(in) :: this integer, intent(in) :: unit character(*), intent(in) :: iotype integer, intent(in) :: v_list(:) integer, intent(out) :: iostat character(*), intent(inout) :: iomsg write(unit, '(a)', iostat=3Diostat, iomsg=3Diomsg) 'dummy' end subroutine write_formatted end module causes_ice module use_t use causes_ice implicit none public :: automatic_alloc contains subroutine automatic_alloc(n) integer, intent(in) :: n ! Automatic array: ICE! type(t) :: automatic(n) ! Allocatable: works type(t), allocatable :: alloc(:) allocate(alloc(n)) ! Do anything print *, 'n=3D',n,automatic(n)%x end subroutine automatic_alloc end module use_t program test use use_t call automatic_alloc(1) end program test I could find other DTIO-related bugs, but none seemed related with the allocation type.=