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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
The code is valid; F2003 7.6.1 "Specification expression" says

R729 specification-expr is scalar-int-expr

C710  (R729) The scalar-int-expr shall be a restricted expression.

A restricted expression is an expression in which each operation is intrinsic
and each primary is

[...]

(8) A reference to any other standard intrinsic function where each argument is
a restricted expression,

One possible workaround:

program main
  integer :: n
  n = command_argument_count()
  block
    integer :: A(n)
    A = 1
    write (*,*) A
  end block
end

Reply via email to