Go for it! LGTM. I was aware this morning that it was the last (as far as I know) of Christopher's regression fixes.
Thanks Paul On Mon, 13 Apr 2026 at 20:48, Jerry D <[email protected]> wrote: > > I all, the attached patch fixes this ICE. > > I do not know if we are in the OK window for this. > > Regression tested on x86_64. > > OK for mainline? > > Regards, > > Jerry > --- > > fortran: Fix ICE in remap_type with deferred-length character > in OMP target [PR101760, PR102314] > > For deferred-length character types such as character(:), allocatable, > TYPE_SIZE and TYPE_SIZE_UNIT contain SAVE_EXPRs wrapping the string > length variable (created by variable_size in finalize_type_size). > In gfc_omp_finish_clause, when computing OMP_CLAUSE_SIZE for implicitly > mapped variables, the code previously used TYPE_SIZE_UNIT directly. > Gimplifying this shared SAVE_EXPR resolves it in place, embedding a > gimple temporary into the type's size expression. When the enclosing > function is later inlined, remap_type_1 walks TYPE_SIZE and encounters > the stale temporary as an unmappable SSA name, causing an ICE in > make_ssa_name_fn. > > Fix by computing the clause size from the array domain bounds and > element size rather than using the type's SAVE_EXPR directly, so > that the type's size expressions remain untouched. > > PR fortran/101760 > PR fortran/102314 > > gcc/fortran/ChangeLog: > > * trans-openmp.cc (gfc_omp_finish_clause): Compute OMP_CLAUSE_SIZE > from the array domain bounds and element size for VLA types instead > of using TYPE_SIZE_UNIT directly, to avoid corrupting the type. > > gcc/testsuite/ChangeLog: > > * gfortran.dg/gomp/pr101760.f90: New test. > * gfortran.dg/gomp/pr102314.f90: New test. > > Signed-off-by: Christopher Albert <[email protected]>
