On 11/17/26 11:57 AM, Thomas Koenig wrote:
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.

Regression-tested. OK for trunk?

Looks OK Thomas.

Thanks,

Jerry


Best regards

     Thomas

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