https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125747

--- Comment #11 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:9d448830cc85414e22839ac5be20c1ca1fd4ce33

commit r17-5265-g9d448830cc85414e22839ac5be20c1ca1fd4ce33
Author: Jerry DeLisle <[email protected]>
Date:   Thu Jun 11 12:05:15 2026 -0700

    fortran: [PR125747] Fix shadow-variable bugs for DO CONCURRENT/FORALL
type-spec

    Give each shadow variable for a type-spec index-name a unique numbered
    name, record the shadowed outer symbol in the iterator, and do not
    substitute into a nested FORALL/DO CONCURRENT that shadows the same
    symbol.

    Assisted-by: Claude Opus 5.5

            PR fortran/125747

    gcc/fortran/ChangeLog:

            * gfortran.h (gfc_forall_iterator): Add shadow_outer_sym.
            * match.cc (apply_typespec_to_iterator): Number the shadow
            variable name and set shadow_outer_sym.
            * resolve.cc (check_default_none_expr): Use shadow_outer_sym.
            (replace_in_code_recursive): Do not recurse into a nested
            FORALL/DO CONCURRENT that shadows old_sym.
            (gfc_resolve_forall): Use shadow_outer_sym.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/do_concurrent_typespec_2.f90: New test.
            * gfortran.dg/do_concurrent_typespec_3.f90: New test.
            * gfortran.dg/do_concurrent_typespec_4.f90: New test.
            * gfortran.dg/do_concurrent_typespec_6.f90: New test.

Reply via email to