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

            Bug ID: 83664
           Summary: Eoshift accepts missing boundary for non-default types
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

The following code is invalid:

program main
  type t
    integer :: x
  end type t
  type(t), dimension(2) :: a, b
  a(1)%x = 1
  a(2)%x = 2
  b = eoshift(a,1)
  print *,b%x
end program main

To quote from the F2003 standard:

BOUNDARY
 shall be of the same type and type parameters as ARRAY and shall be scalar
(optional)
 if ARRAY has rank one; otherwise, it shall be either scalar or of rank n − 1
and of shape (d1, d2 , ..., dDIM−1 , dDIM+1 , ..., dn). BOUNDARY may be
omitted for the types in the following table and, in this case, it is as if it
were
present with the scalar value shown.

(the table then shows Integer, Real, Complex, Logical and Character).

Reply via email to