Le 12/09/2026 à 00:52, Jerry D a écrit :
See attached patch,

This one was buried in my worktree. I started working on TEAM stuff and rediscovered it.

Regression tested on x86_64.

OK for mainline?

OK, thanks.

Regards,

Jerry

---

fortran: [PR103474] Fix ICEs for the cobounds of a subobject
  of a coarray

F2018:5.4.7(5) makes a subobject of a coarray a coarray with the same
codimensions, unless it is reached through a cosubscript, an image
selector, or an allocatable or pointer component selector.  Querying the
cobounds of such a subobject, as in LCOBOUND (X%A), reached three places
that were not prepared for it, and a coarray whose declaration had already
been rejected reached a fourth.

     PR fortran/103474

gcc/fortran/ChangeLog:

     * simplify.cc (simplify_cobound): Take the array spec from the
     base symbol, using its class data for a CLASS coarray, so that a
     subobject of a coarray finds the codimensions.  Return NULL for a
     symbol already flagged as erroneous and in place of the two
     gcc_unreachable calls reached on invalid code.
     * resolve.cc (gfc_expression_rank): Track the reference carrying
     the codimensions and take the corank from it rather than from the
     last array reference.  Clear it at an allocatable or pointer
     component selector, which ends the coarray.
     * trans-intrinsic.cc (strip_subobject_of_coarray): New function.
     Return a copy of the expression cut back to the reference carrying
     the codimensions.
     (conv_intrinsic_cobound, trans_this_image, trans_image_index): Use
     it, so that the descriptor queried for the cobounds is that of the
     coarray and not that of a component of it.

gcc/testsuite/ChangeLog:

     * gfortran.dg/coarray_52.f90: New test.
     * gfortran.dg/coarray/cobounds_subobject_1.f90: New test.
---

Reply via email to