https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128678
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:58eb8771e6ffff54e765560d7435b2f6d679a07c commit r17-6370-g58eb8771e6ffff54e765560d7435b2f6d679a07c Author: Jerry DeLisle <[email protected]> Date: Thu Nov 12 10:28:47 2026 -0800 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.
