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

            Bug ID: 93114
           Summary: Use span passing components of derived types
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

We could be using span instead of creating a temporary array here:

$ cat x.f90
module x
  type y
     real :: a, b
  end type y
contains
  subroutine foo
    type(y), dimension(10) :: v
    call bar(v%a)
  end subroutine foo
  subroutine bar(r)
    real, dimension(:) :: r
  end subroutine bar
end module x
$ gfortran -Warray-temporaries -c x.f90
x.f90:8:13:

    8 |     call bar(v%a)
      |             1
Warning: Creating array temporary at (1) [-Warray-temporaries]

Also an issue for

  complex :: a(10)
  call random_number (a%re)

Reply via email to