https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117539
Bug ID: 117539 Summary: Pure procedure and intent(out) polymorphic pointer argument Product: gcc Version: 14.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: gronki at gmail dot com Target Milestone: --- ``` module bugmod implicit none type value_t end type contains pure subroutine fetch_ptr(ptr) class(value_t), intent(out), pointer :: ptr end subroutine end module ``` gfortran (but also ifx 2025) fails to compile this code with: Error: INTENT(OUT) argument ‘ptr’ of pure procedure ‘fetch_ptr’ at (1) may not be polymorphic The restriction was imposed specifically to prevent the possibility of non-pure finalizers being invoked when the actual argument to intent(out) is being deallocated. But in case of the pointer, no automatic deallocation happens due o intent(out), therefore for pointers this restriction should not be imposed. Related read: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59103 Have a good day! Dominik