public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114001] New: is_contiguous considers unlimited polymorphic dummy always as contiguous
@ 2024-02-19 20:17 anlauf at gcc dot gnu.org
2024-02-20 21:10 ` [Bug fortran/114001] " anlauf at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-02-19 20:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114001
Bug ID: 114001
Summary: is_contiguous considers unlimited polymorphic dummy
always as contiguous
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
While discussing pr105868 I found the following issue:
program main
implicit none
integer :: i
integer, target :: m(10) = [(i,i=1,size(m))]
integer, pointer :: p(:)
p => m(1::3)
print *, "main: is_contiguous (p)=", is_contiguous (p)
print *, p
print *
call sub (p)
contains
subroutine sub (x)
class(*), intent(in) :: x(:)
print *, "sub(1): is_contiguous (x)=", is_contiguous (x) ! <- always true
select type (x)
type is (integer)
print *, "sub(2): is_contiguous (x)=", is_contiguous (x)
print *, x
end select
end
end
This prints (since gcc-9 when is_contiguous was added):
main: is_contiguous (p)= F
1 4 7 10
sub(1): is_contiguous (x)= T
sub(2): is_contiguous (x)= F
1 4 7 10
The dump-tree clearly has:
_gfortran_transfer_character_write (&dt_parm.4, &"sub(1): is_contiguous
(x)="[1]{lb: 1 sz: 1}, 26);
{
static logical(kind=4) C.4341 = 1;
_gfortran_transfer_logical_write (&dt_parm.4, &C.4341, 4);
}
So we aren't actually testing the argument outside the select type block,
whereas:
_gfortran_transfer_character_write (&dt_parm.5, &"sub(2):
is_contiguous (x)="[1]{lb: 1 sz: 1}, 26);
{
struct array01_integer(kind=4) D.4353;
logical(kind=4) D.4354;
D.4353 = __tmp_INTEGER_4;
D.4354 = D.4353.dim[0].stride == 1;
_gfortran_transfer_logical_write (&dt_parm.5, &D.4354, 4);
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/114001] is_contiguous considers unlimited polymorphic dummy always as contiguous
2024-02-19 20:17 [Bug fortran/114001] New: is_contiguous considers unlimited polymorphic dummy always as contiguous anlauf at gcc dot gnu.org
@ 2024-02-20 21:10 ` anlauf at gcc dot gnu.org
2024-03-12 22:13 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-02-20 21:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114001
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #1 from anlauf at gcc dot gnu.org ---
gfc_is_simply_contiguous has the following code:
if (expr->ts.type != BT_CLASS
&& ((part_ref
&& !part_ref->u.c.component->attr.contiguous
&& part_ref->u.c.component->attr.pointer)
|| (!part_ref
&& !sym->attr.contiguous
&& (sym->attr.pointer
|| (sym->as && sym->as->type == AS_ASSUMED_RANK)
|| (sym->as && sym->as->type == AS_ASSUMED_SHAPE)))))
return false;
This obviously ignores the CLASS case.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/114001] is_contiguous considers unlimited polymorphic dummy always as contiguous
2024-02-19 20:17 [Bug fortran/114001] New: is_contiguous considers unlimited polymorphic dummy always as contiguous anlauf at gcc dot gnu.org
2024-02-20 21:10 ` [Bug fortran/114001] " anlauf at gcc dot gnu.org
@ 2024-03-12 22:13 ` anlauf at gcc dot gnu.org
2024-03-13 17:55 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-12 22:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114001
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2024-03-12
--- Comment #2 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2024-March/060320.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/114001] is_contiguous considers unlimited polymorphic dummy always as contiguous
2024-02-19 20:17 [Bug fortran/114001] New: is_contiguous considers unlimited polymorphic dummy always as contiguous anlauf at gcc dot gnu.org
2024-02-20 21:10 ` [Bug fortran/114001] " anlauf at gcc dot gnu.org
2024-03-12 22:13 ` anlauf at gcc dot gnu.org
@ 2024-03-13 17:55 ` cvs-commit at gcc dot gnu.org
2024-03-19 19:21 ` cvs-commit at gcc dot gnu.org
2024-03-19 19:24 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-13 17:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114001
--- Comment #3 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:11caf47b599568c6c6f5a12cf8e21f50778176d3
commit r14-9454-g11caf47b599568c6c6f5a12cf8e21f50778176d3
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Mar 12 22:58:39 2024 +0100
Fortran: fix IS_CONTIGUOUS for polymorphic dummy arguments [PR114001]
gcc/fortran/ChangeLog:
PR fortran/114001
* expr.cc (gfc_is_simply_contiguous): Adjust logic so that CLASS
symbols are also handled.
gcc/testsuite/ChangeLog:
PR fortran/114001
* gfortran.dg/is_contiguous_4.f90: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/114001] is_contiguous considers unlimited polymorphic dummy always as contiguous
2024-02-19 20:17 [Bug fortran/114001] New: is_contiguous considers unlimited polymorphic dummy always as contiguous anlauf at gcc dot gnu.org
` (2 preceding siblings ...)
2024-03-13 17:55 ` cvs-commit at gcc dot gnu.org
@ 2024-03-19 19:21 ` cvs-commit at gcc dot gnu.org
2024-03-19 19:24 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-19 19:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114001
--- Comment #4 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:5b928badac560ad48e0e9fc480096ff396d9d9c6
commit r13-8468-g5b928badac560ad48e0e9fc480096ff396d9d9c6
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Mar 12 22:58:39 2024 +0100
Fortran: fix IS_CONTIGUOUS for polymorphic dummy arguments [PR114001]
gcc/fortran/ChangeLog:
PR fortran/114001
* expr.cc (gfc_is_simply_contiguous): Adjust logic so that CLASS
symbols are also handled.
gcc/testsuite/ChangeLog:
PR fortran/114001
* gfortran.dg/is_contiguous_4.f90: New test.
(cherry picked from commit 11caf47b599568c6c6f5a12cf8e21f50778176d3)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/114001] is_contiguous considers unlimited polymorphic dummy always as contiguous
2024-02-19 20:17 [Bug fortran/114001] New: is_contiguous considers unlimited polymorphic dummy always as contiguous anlauf at gcc dot gnu.org
` (3 preceding siblings ...)
2024-03-19 19:21 ` cvs-commit at gcc dot gnu.org
@ 2024-03-19 19:24 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-19 19:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114001
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |13.3
Status|ASSIGNED |RESOLVED
--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-19 19:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-19 20:17 [Bug fortran/114001] New: is_contiguous considers unlimited polymorphic dummy always as contiguous anlauf at gcc dot gnu.org
2024-02-20 21:10 ` [Bug fortran/114001] " anlauf at gcc dot gnu.org
2024-03-12 22:13 ` anlauf at gcc dot gnu.org
2024-03-13 17:55 ` cvs-commit at gcc dot gnu.org
2024-03-19 19:21 ` cvs-commit at gcc dot gnu.org
2024-03-19 19:24 ` anlauf at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).