This one is a blocker for me on some other work related to DO CONCURRENT. I
plan to commit soon. No problems reported by the bot testers.
Regards,
Jerry
On 11/12/26 12:38 PM, Jerry D wrote:
See the attached patch. I ran into this bug while testing for another unrelated
PR.
Regression tested on x86_64 at -m64 and -m32
OK for mainline?
Regards,
Jerry
---
[PATCH] fortran: [PR128678] Fix OpenMP ctor/dtor for SIMD body-local decls
Gimplify gives an addressable decl local to a SIMD body an implicit
private clause. The Fortran clause hooks treated it like a user's
private variable: the default constructor hit gcc_assert (outer) for a
decl with allocatable components, and the destructor freed the data of
a CLASS temporary, which for a non-polymorphic actual argument is the
actual itself. The body initializes and finalizes such decls, so both
hooks now do nothing for a private clause without an outer reference on
a decl that gfc_omp_private_outer_ref accepts. The destructor also no
longer frees the data of a nonallocatable CLASS copy that
gfc_omp_clause_copy_ctor did not allocate.
Assisted-by: Claude Opus 5.5
PR fortran/128678
gcc/fortran/ChangeLog:
* trans-openmp.cc (gfc_is_class_pointer_type): Rename to ...
(gfc_class_container_kind): ... this. Return the kind suffix of
the class container type name.
(gfc_omp_body_local_private_p): New function.
(gfc_omp_clause_default_ctor): Return NULL_TREE for a body-local
private clause.
(gfc_omp_clause_copy_ctor): Use gfc_class_container_kind.
(gfc_omp_clause_dtor): Likewise. Return NULL_TREE for a body-local
private clause and for a nonallocatable CLASS copy not made by
gfc_omp_clause_copy_ctor.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/simd-body-local-1.f90: New test.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/simd-body-local-1.f90: New test.
---