https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80708
Bug ID: 80708 Summary: [f08] ALLOCATE with MOLD error if source-expr is a derived type with null-init pointer component Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: tamas.bela.feher at ipp dot mpg.de Target Milestone: --- Dear GFortran Team, For the following program: program mold_dtype_with_pointer_component implicit none type t real, dimension(:), pointer :: p => null() end type type(t), dimension(3:4) :: array type(t), allocatable, dimension(:) :: h allocate(H, mold=array) end program GFortran (versions 6.3.0 and 8.0.0 20170427) gives the following error message: gfortran mold_dtype_pointer.f90 mold_dtype_pointer.f90:8:11: allocate(H, mold=array) 1 Error: Array specification or array-valued SOURCE= expression required in ALLOCATE statement at (1) The error disappears if the null-init for pointer p is removed, or if MOLD is replaced with SOURCE. I would expect that the program compiles even in its original form. Best regards, Tamas