From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C005D3861845; Wed, 29 Nov 2023 20:37:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C005D3861845 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701290268; bh=uW+OqrLZ92mllVKE6asnTtCI79JeYfoeJ+w1R4aeY+s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZCfrf3maWSWJCOBfv0P1i3ZJRbgpwN1ri3SszsCqerzw/7lZ0jMoKIYvMWTwd6TrI sAYHGqwdz9+oYlQeonO341JpXA1HYRzfXfGHN4OFTAui9CAEMEHWQNI1EWo9xZDU0y NLFL8dvaXRjfhIjHhbNjlpiZ9HseaZjp3Qxajsh4= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block Date: Wed, 29 Nov 2023 20:37:48 +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.1.0 X-Bugzilla-Keywords: rejects-valid 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: 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=3D112764 --- Comment #5 from anlauf at gcc dot gnu.org --- (In reply to martin from comment #4) > (In reply to anlauf from comment #1) > > Confirmed. > >=20 > > F2018:11.1.3.3 has: > >=20 > > "The associating entity does not have the ALLOCATABLE or POINTER attrib= utes; > > it has the TARGET attribute if and only if the selector is a variable a= nd has > > either the TARGET or POINTER attribute." >=20 > I was not sure, whether this formulation also covers array sections. The following example has apparently always been legal, is accepted and wor= ks: integer, pointer :: x, y(:) integer, allocatable, target :: z(:) allocate (y(2), z(3)) y =3D 42 x =3D> y(2) print *,x z =3D 23 x =3D> z(2) print *,x end I think this is covered by F2018:8.5.17 TARGET attribute, although I find the text somewhat hard to understand. Like: "If an object has the TARGET attribute, then all of its nonpointer subobjec= ts also have the TARGET attribute." IIUC that would cover array sections.=