[Bug fortran/102966] New: size() returns 0 for an unallocated array, no error message or error exit

b.j.braams at cwi dot nl gcc-bugzilla@gcc.gnu.org
Wed Oct 27 17:18:59 GMT 2021


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

            Bug ID: 102966
           Summary: size() returns 0 for an unallocated array, no error
                    message or error exit
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: b.j.braams at cwi dot nl
  Target Milestone: ---

Using GNU Fortran (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1).

The four-line test program is:

PROGRAM test
  integer, allocatable :: ar(:)
  print *, size(ar)
END PROGRAM test

I compile with flags -Wall and -fcheck=all

gfortran -Wall -fcheck=all test.f90

This produces a.out without warning, and then ./a.out just prints 0 without
error message.

The expected result for me, especially with -fcheck=all, is an error exit at
run time. Un unallocated array is not a zero-size array.


More information about the Gcc-bugs mailing list