http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47506

           Summary: [OOP][Fortran 90+] Assumed-size array checks
                    (polymorphic and component)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


===================================================
a) Fortran 90 and later:
===================================================

Aleks noted at http://j3-fortran.org/pipermail/j3/2011-January/004154.html the
gfortran misses a diagnostic for the following program.

Ifort prints:
  The upper bound shall not be omitted in the last dimension of a reference
  to an assumed size array.   [X]
       call sub2(x%i)
-----------------^

NAG has: Error: line 16: Invalid appearance of assumed-size array name X

Pathscale/open64 have:
  This whole array reference of an assumed-size array is not allowed.

program test
    type :: t
       integer :: i
       real :: r
    end type
    type(t) :: x(10)
    call sub1(x)
contains
    subroutine sub1(x)
       type(t) :: x(*)
       call sub2(x%i)  ! WRONG: Should be, e.g., x(:10)%i
    end subroutine
    subroutine sub2(x)
       integer :: x(*)
    end subroutine
end program

===================================================
b) [OOP] Fortran 2003 and later
===================================================

Bill noted at http://j3-fortran.org/pipermail/j3/2011-January/004148.html in
the same thread that the standard (nor gfortran) reject:

  assumed-size poly actual -> non-poly dummy

although for most compilers (but IBM's?) it will not work. Sketched example:

subroutine before(w)
use typedef
! Interface for A here
type(T) :: w(*) ! no descriptor here - size not known
call A(w)
end

subroutine A (x)
use typedef ! types T and extensions defined in here
class(T) :: x(*)
...
call B(x)
...
end

subroutine B(y)
use typedef
type(T) :: y(*)


 * * *

Bob believes both are invalid - and covered by:

      An assumed-size array (5.3.6.5) is permitted to appear as a whole
      array in an executable construct or specification expression only
      as an actual argument in a procedure reference that does not
      require the shape.

Reply via email to