pgfortran thinks it's allowed to have a type inquiry result an array

Consider the following program:

  type t(n)
     integer, kind :: n=1
  end type t
  type(t) x(1)

  if (SIZE(SHAPE(x%n)).ne.0) ERROR STOP "Type parameter inquiry result is not scalar"

pgfortran 19.10 incorrectly returns “x%n” as an array rather than the scalar that it should.

This looks like a bug. From the Fortran 2008 spec, a type parameter inquiry result is scalar even if the LHS of the inquiry is an array, section 6.4.5 note 6.7. I’ve filed TPR #27849 to track the issue.