[Bug fortran/82056] New: Automatic array can be sized via allocatable array

arjen.markus at deltares dot nl gcc-bugzilla@gcc.gnu.org
Thu Aug 31 11:59:00 GMT 2017


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

            Bug ID: 82056
           Summary: Automatic array can be sized via allocatable array
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arjen.markus at deltares dot nl
  Target Milestone: ---

The following program is accepted without complaints from the compiler:

module chkdim
    implicit none

contains

subroutine calculate
    real, dimension(:), allocatable :: x
    real, dimension(size(x))        :: y

    write(*,*) 'Sizes:', size(x), size(y)
end subroutine calculate
end module chkdim

program chkit
    use chkdim

    call calculate
end program chkit

The problem however is that by relating the size of the automatic array (y) to
that of a (local) allocatable array, the size of y is essentially undetermined.

Ideally, the compiler should issue an error or a warning about it.


More information about the Gcc-bugs mailing list