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

--- Comment #5 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #3)
> (In reply to anlauf from comment #2)
> > I think the problem is we consider command_argument_count() as a pure
> > function,
> > so that gfc_is_constant_expr returns true.
> 
> Well, it is a pure function.  Fortran 2018, page 327,
> 
>     All standard intrinsic functions are pure.

I think we need to look at the specific function in gfc_is_constant_expr.

The Fortran standard has

   10.1.12 Constant expression

  A constant expression is an expression with limitations that make
  it suitable for use as a kind type parameter, initializer, or named
  constant. It is an expression in which each operation is intrinsic,
  and each primary is
  ...
  (5) a reference to an elemental standard intrinsic function, where
      each argument is a constant expression,

  (6) a reference to a standard intrinsic function that is
      transformational, other than COMMAND_ARGUMENT_COUNT, GET_TEAM,
      NULL, NUM_IMAGES, TEAM_NUMBER, THIS_IMAGE, or TRANSFER, where
      each argument is a constant expression,

So, if I untangle (6), gfortran needs to reject the listed intrinsic
function except for TRANSFER where a different restrict applies.

Reply via email to