https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78640
Bug ID: 78640 Summary: [F2015] gfortran accepts invalid allocatable polymorphic result in pure function Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: damian at sourceryinstitute dot org Target Milestone: --- Constraint C1589 in Draft 16-007r2 of the Fortran 2015 standard states "A pure function shall not have a polymorphic allocatable result." As demonstrated below, a 20161127 build of gfortran 7.0.0 accepts code that violates the above constraint: $ cat poly-alloc-result.f90 type foo end type type(foo) :: bar bar = f() contains pure function f() result(y) class(foo), allocatable :: y allocate(foo::y) end function end $ gfortran poly-alloc-result.f90 $ ./a.out $ gfortran --version GNU Fortran (MacPorts gcc7 7-20161127_0) 7.0.0 20161127 (experimental)