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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Thomas Koenig <[email protected]>:

https://gcc.gnu.org/g:097c665c2be380feed1e2bcf3202a79a7f7bd2d3

commit r17-6365-g097c665c2be380feed1e2bcf3202a79a7f7bd2d3
Author: Thomas Koenig <[email protected]>
Date:   Tue Nov 17 20:55:09 2026 +0100

    Use memset for zeroing contiguous array slices.

    This patch also uses memset for zeroing contiguous array slices. A
    regression led to the discovery that, for

       real, dimension (1,2) :: b
       b(1,:) = 0.
       end

    gfc_is_simply_contiguous returned false, whereas gfc_full_array_ref_p
    returned true. This is also fixed.

    gcc/fortran/ChangeLog:

            PR fortran/40598
            PR fortran/128776
            * expr.cc (gfc_is_simply_contiguous): An extent of one can
            also be contiguous.
            * trans-expr.cc (gfc_trans_zero_assign): Modify to also deal with
            array slices.
            (copyable_slice_p): Reallocatable expressions can be fine; check
            is in gfc_trans_assignment. Also return false for expressions
            which have a corank.
            (gfc_trans_assignment): Use copyable_slice_p instead of
            copyable_array_p for gfc_trans_zero_assign.

    gcc/testsuite/ChangeLog:

            PR fortran/40598
            PR fortran/128776
            * gfortran.dg/vect/fast-math-rnflow-trs2a2.f90: Adjust vect count;
            zeroing is now done by memset.
            * gfortran.dg/array_memset_4.f90: New test.

Reply via email to