From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4A6703858C31; Tue, 26 Sep 2023 20:28:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A6703858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695760107; bh=MgolfVqUcXXMt3+U2Ua/N8IHbaFFw9FwGK13ZJIjS/w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EEexcDl2ddUU75mLIvF6kgxqL7W8XawzMLx0YIHyLGtPThVEeAk+BkndUgSZVti1/ 1binhgWjwJqMxyjCqEFog4g8SK6D1JyGgEz/r0nYO7R19MXZvR8PR+5p4OI/DuvPBu O56Ki0zGT+0dlKjK6C6R4jDXUrTjOgcbyC1xl+nI= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/67740] Wrong association status of allocatable character pointer in derived types Date: Tue, 26 Sep 2023 20:28:27 +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: 5.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW 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: keywords 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=3D67740 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code --- Comment #6 from anlauf at gcc dot gnu.org --- Extending the testcase in comment#4: program test2 implicit none character(len=3D10), allocatable, target :: s(:) character(len=3D:), pointer :: sptr(:) type :: pointer_typec0_t character(len=3D:), pointer :: data1(:) end type pointer_typec0_t type(pointer_typec0_t) :: co ! allocate(s(3)) s(1) =3D '1234567890' s(2) =3D 'qwertyuio ' s(3) =3D 'asdfghjk ' ! sptr =3D> s print *, sptr ! OK co%data1 =3D> s print *, co%data1 ! not OK ! print *,len(co%data1(1)),len_trim(co%data1(1)),co%data1(1) print *,len(co%data1(2)),len_trim(co%data1(2)),co%data1(2) print *,len(co%data1(3)),len_trim(co%data1(3)),co%data1(3) end program test2 The tree-dump has: .sptr =3D 10; sptr =3D s; sptr.span =3D s.span; but co.data1 =3D s; co.data1.span =3D s.span; so we don't set the character length in the association.=