From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 419983858413; Mon, 20 Mar 2023 15:54:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 419983858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679327685; bh=ldx2V8E+nXCuHpk9009ao4wKKbGf3rs+RhVlvHzFf2g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TL5qaWqf9Qr9GLzkqAuLpKCxEMSzPiCuQNjwZSZp1Kn6euA0L+yNOLCOnQwKgsLZj yHl8XxLyv8T/J+EXL8soT29wdhF/RrUkfvAv++RgA6sg7jZiV/Ar/X9CIXTrrsDZEd ronl+eI2V8JZH2XtlqPh4AFLeE9sKzx6LQi01ILw= From: "juergen.reuter at desy dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109209] [13 regression] erroneous error on assignment of alloctables Date: Mon, 20 Mar 2023 15:54:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: juergen.reuter at desy dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=3D109209 --- Comment #4 from J=C3=BCrgen Reuter --- Here is the promised reproducer, which fails even when not using submodules: $ gfortran -c reproducer.f90=20 reproducer.f90:69:4: 69 | history_new(1:s) =3D res_set%history(1:s) | 1 Error: Component to the right of a part reference with nonzero rank must not have the ALLOCATABLE attribute at (1) reproducer.f90:69:23: 69 | history_new(1:s) =3D res_set%history(1:s) | 1 Error: Component to the right of a part reference with nonzero rank must not have the ALLOCATABLE attribute at (1) module resonances implicit none private type :: t1_t integer, dimension(:), allocatable :: c contains procedure, private :: t1_assign generic :: assignment(=3D) =3D> t1_assign end type t1_t type :: t3_t type(t1_t), dimension(:), allocatable :: resonances integer :: n_resonances =3D 0 contains procedure, private :: t3_assign generic :: assignment(=3D) =3D> t3_assign end type t3_t type :: resonance_branch_t integer :: i =3D 0 integer, dimension(:), allocatable :: r_child integer, dimension(:), allocatable :: o_child end type resonance_branch_t type :: resonance_tree_t private integer :: n =3D 0 type(resonance_branch_t), dimension(:), allocatable :: branch end type resonance_tree_t type :: t3_set_t private type(t3_t), dimension(:), allocatable :: history type(resonance_tree_t), dimension(:), allocatable :: tree integer :: last =3D 0 contains procedure, private :: expand =3D> t3_set_expand end type t3_set_t contains pure subroutine t1_assign & (t1_out, t1_in) class(t1_t), intent(inout) :: t1_out class(t1_t), intent(in) :: t1_in if (allocated (t1_out%c)) deallocate (t1_out%c) if (allocated (t1_in%c)) then allocate (t1_out%c (size (t1_in%c))) t1_out%c =3D t1_in%c end if end subroutine t1_assign subroutine t3_assign (res_hist_out, res_hist_in) class(t3_t), intent(out) :: res_hist_out class(t3_t), intent(in) :: res_hist_in if (allocated (res_hist_in%resonances)) then res_hist_out%resonances =3D res_hist_in%resonances res_hist_out%n_resonances =3D res_hist_in%n_resonances end if end subroutine t3_assign module subroutine t3_set_expand (res_set) class(t3_set_t), intent(inout) :: res_set type(t3_t), dimension(:), allocatable :: history_new integer :: s s =3D size (res_set%history) allocate (history_new (2 * s)) history_new(1:s) =3D res_set%history(1:s) call move_alloc (history_new, res_set%history) end subroutine t3_set_expand end module resonances=