On Sat, Sep 5, 2026 at 9:18 AM Jerry D <[email protected]> wrote:
>
> ping

It has been approved:

https://gcc.gnu.org/pipermail/gcc-patches/2026-September/729707.html

> On 9/1/26 3:22 PM, Jerry D wrote:
> > See attached patch. Tobias confirmed the problem he reported in the PR is 
> > fixed
> > by this.
> >
> > Regression tested on x86_64. The changelog summarizes quite well.
> >
> > As noted in my email about 126964, this patch is needed to avoid the runtime
> > checking in my patch previously submitted for it. I had this sitting in my
> > worktree and got sidetracked chasing 126964.
> >
> > OK for mainline?
> >
> > Best regards,
> >
> > Jerry
> >
> > ---
> >
> > [PATCH] fortran: [PR126950] Load the span of a span addressed dummy
> >   on entry
> >
> > A TARGET assumed-shape dummy is addressed through the span of its
> > descriptor since r17-3342.  Its bounds and data pointer are loaded into
> > local variables on entry, but the span was reloaded from the descriptor
> > at each element reference.  Inside an outlined region, such as an OpenMP
> > target region, only those local variables are available; the descriptor
> > is not mapped to the device, so the reload dereferenced a host pointer
> > there and the region used a garbage span.
> >
> > Load the span on entry as well, alongside the bounds, and use that
> > variable for element addressing.  The variable is created with the
> > dummy's declaration because the procedure body is translated before
> > gfc_trans_dummy_array_bias emits the load.  The load is placed in the
> > init block, which is already guarded by the argument being present, so
> > an absent optional dummy is not dereferenced.
> >
> > Assisted-by: Claude Opus 5
> >
> >      PR fortran/126950
> >
> > gcc/fortran/ChangeLog:
> >
> >      * trans.h (struct lang_decl): Add span.
> >      (GFC_DECL_SPAN, GFC_DECL_GET_SPAN): New macros.
> >      * trans-decl.cc (gfc_build_dummy_array_decl): Create the variable
> >      holding the span of a span addressed dummy.
> >      * trans-array.cc (gfc_trans_dummy_array_bias): Load it from the
> >      descriptor on entry.
> >      (gfc_get_array_span): Use it.
> >      * trans.cc (get_array_span): Likewise.
> >
> > gcc/testsuite/ChangeLog:
> >
> >      * gfortran.dg/c_loc_test_22.f90: Update dump patterns for the
> >      span being loaded on entry.
> >      * gfortran.dg/gomp/target-span-1.f90: New test.
> > ---
>


-- 
H.J.

Reply via email to