Hi all, I successfully created a big mess with the previous patch. First of all by applying an outdated one and secondly by adding the conformance checks for coranks in a3f1cdd8ed46f9816b31ab162ae4dac547d34ebc. Checking the standard even using AI (haha) to figure if coranks of an expression have restrictions on them, failed. I found nothing. AI fantasized about restrictions that did not exist. Therefore the current approach is to remove the conformance check and just use the computed coranks in expressions to prevent recomputaion whenever they needed.
Jerry, Harald: Sorry for all the bother and all my mistakes. I am really sorry to have wasted your time. The patch has been regtested fine on x86_64-pc-linux-gnu / F41. Ok for mainline and later backport to gcc-15? Regards, Andre On Tue, 1 Jul 2025 11:17:58 +0200 Andre Vehreschild <ve...@gmx.de> wrote: > Hi Harald, > > thanks for the review. Committed as gcc-16-1885-g1b0930e9046. > > Will backport to gcc-15 in about a week. > > Thanks again. > > Regards, > Andre > > On Mon, 30 Jun 2025 22:31:08 +0200 > Harald Anlauf <anl...@gmx.de> wrote: > > > Am 30.06.25 um 15:25 schrieb Andre Vehreschild: > > > Hi all, > > > > > > here now the version of the patch that seems to be more complete. > > > > > > Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline and later > > > backport to gcc-15? > > > > This looks good to me. OK for both. > > > > Thanks for the patch! > > > > Harald > > > > > Regards, > > > Andre > > > > > > On Fri, 27 Jun 2025 15:44:20 +0200 > > > Andre Vehreschild <ve...@gmx.de> wrote: > > > > > >> I take this patch back. It seems to be incomplete. > > >> > > >> - Andre > > >> > > >> On Fri, 27 Jun 2025 14:45:36 +0200 > > >> Andre Vehreschild <ve...@gmx.de> wrote: > > >> > > >>> Hi all, > > >>> > > >>> this patch fixes a reject valid when the coranks of two operands do not > > >>> match and no coindex is given. I.e. when only an implicit this_image > > >>> co-ref is used. > > >>> > > >>> Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline? > > >>> > > >>> Regards, > > >>> Andre > > >> > > >> > > > > > > > > > > -- Andre Vehreschild * Email: vehre ad gmx dot de
From 3ad3d551fb457698b61ed459afa0b58bf8574df8 Mon Sep 17 00:00:00 2001 From: Andre Vehreschild <ve...@gcc.gnu.org> Date: Wed, 2 Jul 2025 11:06:17 +0200 Subject: [PATCH] Fortran: Remove corank conformability checks [PR120843] Remove the checks on coranks conformability in expressions, because there is nothing in the standard about it. When a coarray has no coindexes it it treated like a non-coarray, when it has a full-corank coindex its result is a regular array. So nothing to check for corank conformability. PR fortran/120843 gcc/fortran/ChangeLog: * resolve.cc (resolve_operator): Remove conformability check, because it is not in the standard. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/coindexed_6.f90: Enhance test to have coarray components covered. --- gcc/fortran/resolve.cc | 29 ------------------- .../gfortran.dg/coarray/coindexed_6.f90 | 13 +++++++-- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 50a6fe7fc52..4a6e951cdf1 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -4807,35 +4807,6 @@ resolve_operator (gfc_expr *e) return false; } } - - /* coranks have to be equal or one has to be zero to be combinable. */ - if (op1->corank == op2->corank || (op1->corank != 0 && op2->corank == 0)) - { - e->corank = op1->corank; - /* Only do this, when regular array has not set a shape yet. */ - if (e->shape == NULL) - { - if (op1->corank != 0) - { - e->shape = gfc_copy_shape (op1->shape, op1->corank); - } - } - } - else if (op1->corank == 0 && op2->corank != 0) - { - e->corank = op2->corank; - /* Only do this, when regular array has not set a shape yet. */ - if (e->shape == NULL) - e->shape = gfc_copy_shape (op2->shape, op2->corank); - } - else if ((op1->ref && !gfc_ref_this_image (op1->ref)) - || (op2->ref && !gfc_ref_this_image (op2->ref))) - { - gfc_error ("Inconsistent coranks for operator at %L and %L", - &op1->where, &op2->where); - return false; - } - break; case INTRINSIC_PARENTHESES: diff --git a/gcc/testsuite/gfortran.dg/coarray/coindexed_6.f90 b/gcc/testsuite/gfortran.dg/coarray/coindexed_6.f90 index 8f5dcabb859..d566c504134 100644 --- a/gcc/testsuite/gfortran.dg/coarray/coindexed_6.f90 +++ b/gcc/testsuite/gfortran.dg/coarray/coindexed_6.f90 @@ -5,13 +5,20 @@ program p implicit none - integer, allocatable :: arr(:,:) [:,:] + type T + integer, allocatable :: arr(:,:) [:,:] + end type + + type(T) :: o + integer, allocatable :: vec(:)[:,:] integer :: c[*] c = 7 - allocate(arr(4,3)[2,*], source=6) + allocate(o%arr(4,3)[2,*], source=6) + allocate(vec(10)[1,*], source=7) - if (arr(2,2)* c /= 42) stop 1 + if (vec(3) * c /= 49) stop 1 + if (o%arr(2,2)* c /= 42) stop 2 end program p -- 2.50.0