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

            Bug ID: 68078
           Summary: segfault with allocate and stat for derived types with
                    default initialization
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Joost.VandeVondele at mat dot ethz.ch
  Target Milestone: ---

The following testcase:

> cat test.f90
TYPE foo
  INTEGER, DIMENSION(10000) :: data=42
END TYPE
TYPE(foo), POINTER :: fooptr

DO 
  ALLOCATE(fooptr,stat=istat)
  IF (istat.NE.0) EXIT
ENDDO
END

> ulimit -v 1000000
> gfortran -g test.f90 && ./a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Presumably the default initialization is attempted even if fooptr is null. In
case of a present istat, this should not happen. Ifort deals fine with the
case.

Reply via email to