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

           Summary: Add runtime diagnostics for SIZE intrinsic function
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libfortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: thenl...@users.sourceforge.net


As has been brought up before (Bug 20406), the SIZE intrinsic returns an
unpredictable result if the argument is an unallocated allocatable or a pointer
that is not associated.

While this is perfectly standard-conforming behaviour, it would be helpful in
program development to have SIZE throw a runtime error if this condition
occurs.

I.e. SIZE should first check if an array is ALLOCATED or a pointer is
ASSOCIATED and abort with a runtime error if that is not the case.

Fortran 2008:

13.7.156 SIZE (ARRAY [, DIM, KIND])
3 Arguments.
ARRAY shall be an array of any type. It shall not be an unallocated allocatable
variable or a pointer that is not associated. If ARRAY is an assumed-size
array, DIM shall be present with a value less than the rank of ARRAY.

Reply via email to