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

            Bug ID: 115935
           Summary: Extend lowering memset for array when it's a component
                    reference
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: prathamesh3492 at gcc dot gnu.org
  Target Milestone: ---

Hi,
For the following test-case:

subroutine test_dt (dt, y)
   implicit none
   real :: y (10, 20, 30)
   type t
      real :: x(10, 20, 30)
   end type t
   type(t) :: dt
   y = 0
   dt% x = 0
end subroutine

With trunk, it generates memset for 'y' but not for dt%x.
That happens because copyable_array_p returns false for dt%x,
because expr->ref->next is non NULL:

  /* First check it's an array.  */
  if (expr->rank < 1 || !expr->ref || expr->ref->next)
    return false;

and gfc_full_array_ref_p(expr) bails out if expr->ref->type != REF_ARRAY.

Link to ML discussion:
https://gcc.gnu.org/pipermail/fortran/2024-July/060664.html

Thanks,
Prathamesh
  • [Bug fortran/115935] New: E... prathamesh3492 at gcc dot gnu.org via Gcc-bugs

Reply via email to