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

            Bug ID: 119994
           Summary: Valid specification expression in block rejected
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: neil.n.carlson at gmail dot com
  Target Milestone: ---

The following example is rejected with the following error:

     19 |       real :: array(this%n)
        |                    1
  Error: Dummy argument 'this' at (1) cannot be INTENT(OUT)

module foo

  type :: bar
    integer :: n
  end type

contains

  subroutine init(this, n)
    type(bar), intent(out) :: this
    integer, intent(in) :: n
    this%n = n
    block
      real :: array(this%n)
    end block
  end subroutine

end module

This is incorrect. THIS%N is an object designator with a base object (THIS)
that is made accessible by host association (2018: 10.1.11 par 2, item 4) and
thus is a restricted expression and a valid specification expression. The Intel
compiler also gets this wrong, but NAG gets it correct.

Reply via email to