This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/65223] Elemental type-bound procedure's passed object with INTENT(OUT) should be accepted with -std=f2003 (?).


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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
            Summary|Regresion on elemental      |Elemental type-bound
                   |type-bound procedure's      |procedure's passed object
                   |passed object with          |with INTENT(OUT) should be
                   |INTENT(OUT)                 |accepted with -std=f2003
                   |                            |(?).

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
AFAICT the condition

if (sym->ts.type == BT_CLASS && sym->attr.intent == INTENT_OUT)

implement the constraints C1290 (from my copy of the f2015 draft, see
fortran.dg/class_dummy_5.f90 for the rationale)

1.6.4 Fortran 2003 compatibility

...

6 Fortran 2003 permitted the function result of a pure function to be
  a polymorphic allocatable variable, and to be finalizable by an impure final
  subroutine. These are not permitted by this part of ISO/IEC 1539.
7 Fortran 2003 permitted an INTENT (OUT) argument of a pure subroutine to be
  polymorphic; that is not permitted by this part of ISO/IEC 1539.

12.7 Pure procedures

...

C1289 An INTENT (OUT) dummy argument of a pure procedure shall not be such that
      finalization of the actual argument would reference an impure procedure.
C1290 An INTENT (OUT) dummy argument of a pure procedure shall not be
polymorphic.

Since the constraints are Fortran 2008, IMO the code should compile with
-std=f2003. In addition I am not sure that constraint C1289 is implemented:
compiling

module storage_mod
    implicit none
    private
    save

    type, public :: StorageClass
        character(20) :: name = 'default'
    contains
        procedure, nopass :: destroy => destroyStorage
    end type
contains
    elemental subroutine destroyStorage(this)
    type(StorageClass), intent(OUT) :: this
    end subroutine
end module storage_mod
end

should give an error(?).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]