* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
@ 2023-11-29 18:02 ` anlauf at gcc dot gnu.org
2023-11-29 20:09 ` anlauf at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-11-29 18:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-11-29
Status|UNCONFIRMED |NEW
--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.
F2018:11.1.3.3 has:
"The associating entity does not have the ALLOCATABLE or POINTER attributes;
it has the TARGET attribute if and only if the selector is a variable and has
either the TARGET or POINTER attribute."
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
2023-11-29 18:02 ` [Bug fortran/112764] " anlauf at gcc dot gnu.org
@ 2023-11-29 20:09 ` anlauf at gcc dot gnu.org
2023-11-29 20:10 ` anlauf at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-11-29 20:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #2 from anlauf at gcc dot gnu.org ---
Created attachment 56723
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56723&action=edit
Untested patch
The attached patch fixes the issue. Needs regtesting.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
2023-11-29 18:02 ` [Bug fortran/112764] " anlauf at gcc dot gnu.org
2023-11-29 20:09 ` anlauf at gcc dot gnu.org
@ 2023-11-29 20:10 ` anlauf at gcc dot gnu.org
2023-11-29 20:17 ` mscfd at gmx dot net
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-11-29 20:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
CC| |pault at gcc dot gnu.org
--- Comment #3 from anlauf at gcc dot gnu.org ---
CC'ing Paul. He's the expert on ASSOCIATE issues.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
` (2 preceding siblings ...)
2023-11-29 20:10 ` anlauf at gcc dot gnu.org
@ 2023-11-29 20:17 ` mscfd at gmx dot net
2023-11-29 20:37 ` anlauf at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mscfd at gmx dot net @ 2023-11-29 20:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
--- Comment #4 from martin <mscfd at gmx dot net> ---
(In reply to anlauf from comment #1)
> Confirmed.
>
> F2018:11.1.3.3 has:
>
> "The associating entity does not have the ALLOCATABLE or POINTER attributes;
> it has the TARGET attribute if and only if the selector is a variable and has
> either the TARGET or POINTER attribute."
I was not sure, whether this formulation also covers array sections.
Anyway, thanks for the fast reply!
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
` (3 preceding siblings ...)
2023-11-29 20:17 ` mscfd at gmx dot net
@ 2023-11-29 20:37 ` anlauf at gcc dot gnu.org
2023-11-29 21:17 ` anlauf at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-11-29 20:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
--- Comment #5 from anlauf at gcc dot gnu.org ---
(In reply to martin from comment #4)
> (In reply to anlauf from comment #1)
> > Confirmed.
> >
> > F2018:11.1.3.3 has:
> >
> > "The associating entity does not have the ALLOCATABLE or POINTER attributes;
> > it has the TARGET attribute if and only if the selector is a variable and has
> > either the TARGET or POINTER attribute."
>
> I was not sure, whether this formulation also covers array sections.
The following example has apparently always been legal, is accepted and works:
integer, pointer :: x, y(:)
integer, allocatable, target :: z(:)
allocate (y(2), z(3))
y = 42
x => y(2)
print *,x
z = 23
x => 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 subobjects
also have the TARGET attribute."
IIUC that would cover array sections.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
` (4 preceding siblings ...)
2023-11-29 20:37 ` anlauf at gcc dot gnu.org
@ 2023-11-29 21:17 ` anlauf at gcc dot gnu.org
2023-11-30 12:38 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-11-29 21:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
--- Comment #6 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-November/059974.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
` (5 preceding siblings ...)
2023-11-29 21:17 ` anlauf at gcc dot gnu.org
@ 2023-11-30 12:38 ` cvs-commit at gcc dot gnu.org
2023-11-30 21:21 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-30 12:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:951a3e3749a9bf15cea3940ad4bd76d696e1b0b6
commit r14-6011-g951a3e3749a9bf15cea3940ad4bd76d696e1b0b6
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Nov 29 21:47:24 2023 +0100
Fortran: fix TARGET attribute of associating entity in ASSOCIATE [PR112764]
The associating entity in an ASSOCIATE construct has the TARGET attribute
if and only if the selector is a variable and has either the TARGET or
POINTER attribute (e.g. F2018:11.1.3.3).
gcc/fortran/ChangeLog:
PR fortran/112764
* primary.cc (gfc_variable_attr): Set TARGET attribute of
associating
entity dependent on TARGET or POINTER attribute of selector.
gcc/testsuite/ChangeLog:
PR fortran/112764
* gfortran.dg/associate_62.f90: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
` (6 preceding siblings ...)
2023-11-30 12:38 ` cvs-commit at gcc dot gnu.org
@ 2023-11-30 21:21 ` cvs-commit at gcc dot gnu.org
2023-11-30 21:23 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-30 21:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:dd5d399fc16ebe7a1a2b13ae8cb888d619af695c
commit r13-8110-gdd5d399fc16ebe7a1a2b13ae8cb888d619af695c
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Nov 29 21:47:24 2023 +0100
Fortran: fix TARGET attribute of associating entity in ASSOCIATE [PR112764]
The associating entity in an ASSOCIATE construct has the TARGET attribute
if and only if the selector is a variable and has either the TARGET or
POINTER attribute (e.g. F2018:11.1.3.3).
gcc/fortran/ChangeLog:
PR fortran/112764
* primary.cc (gfc_variable_attr): Set TARGET attribute of
associating
entity dependent on TARGET or POINTER attribute of selector.
gcc/testsuite/ChangeLog:
PR fortran/112764
* gfortran.dg/associate_62.f90: New test.
(cherry picked from commit 951a3e3749a9bf15cea3940ad4bd76d696e1b0b6)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
` (7 preceding siblings ...)
2023-11-30 21:21 ` cvs-commit at gcc dot gnu.org
@ 2023-11-30 21:23 ` anlauf at gcc dot gnu.org
2023-12-01 5:29 ` mscfd at gmx dot net
2023-12-01 17:52 ` anlauf at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-11-30 21:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Target Milestone|--- |13.3
Resolution|--- |FIXED
--- Comment #9 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-14, and backported to 13-branch. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
` (8 preceding siblings ...)
2023-11-30 21:23 ` anlauf at gcc dot gnu.org
@ 2023-12-01 5:29 ` mscfd at gmx dot net
2023-12-01 17:52 ` anlauf at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: mscfd at gmx dot net @ 2023-12-01 5:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
--- Comment #10 from martin <mscfd at gmx dot net> ---
Thanks for the speedy fix! I just thought about a variation, which should now
with the fix work as well (was not yet able to compile current dev branch, so
cannot check myself):
program assoc_ptr_in
implicit none
integer, dimension(:,:), pointer :: x
integer, pointer :: j
allocate(x(1:100,1:2), source=123)
associate(i1 => x(:,1))
call sub(i1)
end associate
deallocate(x)
contains
subroutine sub(j)
integer, dimension(:), pointer, intent(in) :: j
print *,j(1)
end subroutine sub
end program assoc_ptr_in
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/112764] Associating entity does not have target attribute if selector has pointer attribute in associate block
2023-11-29 14:01 [Bug fortran/112764] New: Associating entity does not have target attribute if selector has pointer attribute in associate block mscfd at gmx dot net
` (9 preceding siblings ...)
2023-12-01 5:29 ` mscfd at gmx dot net
@ 2023-12-01 17:52 ` anlauf at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-01 17:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112764
--- Comment #11 from anlauf at gcc dot gnu.org ---
(In reply to martin from comment #10)
> Thanks for the speedy fix! I just thought about a variation, which should
> now with the fix work as well (was not yet able to compile current dev
> branch, so cannot check myself):
>
>
> program assoc_ptr_in
This compiles now and prints:
123
^ permalink raw reply [flat|nested] 12+ messages in thread