public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/104143] New: [F2018] Accept scalar actual arguments to assumed-type assumed-size array dummies [type(*), dimension(*)]
Date: Thu, 20 Jan 2022 08:43:13 +0000	[thread overview]
Message-ID: <bug-104143-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 104143
           Summary: [F2018] Accept scalar actual arguments to assumed-type
                    assumed-size array dummies [type(*), dimension(*)]
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Passing a (non-character) scalar to an assumed-type assumed-size array dummy is
now
permitted - new in Fortran 2018 (see last bullet in the quote below).


Fortran 2008 (12.5.2.4 Ordinary dummy variables):

"... If the actual argument is a noncoindexed scalar, the corresponding dummy
argument
 shall be scalar unless the actual argument is default character, of type
character
 with the C character kind (15.2.2), or is an element or substring of an
element
 of an array that is not an assumed-shape, pointer, or polymorphic array."

Fortran 2018:

"If the actual argument is a noncoindexed scalar, the corresponding dummy
argument
 shall be scalar unless
 • the actual argument is default character, of type character with the C
character kind
   (18.2.2), or is an element or substring of an element of an array that is
not an
   assumed-shape, pointer, or polymorphic array,
 • the dummy argument has assumed-rank, or
 • the dummy argument is an assumed-type assumed-size array."

Example:
 interface
   subroutine foo(x)
     type(*) :: x(*)
   end
 end interface
 integer :: a
 call foo(a)
end

(When a generic interface is used, passing a scalar or array element to an
assumed-size array is not permitted - at least that's how GCC+ifort have
implemented it.)

(The new feature avoids the need to use the '!GCC$ ATTRIBUTES NO_ARG_CHECK'
attribute as workaround.)

             reply	other threads:[~2022-01-20  8:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20  8:43 burnus at gcc dot gnu.org [this message]
2022-09-20 21:06 ` [Bug fortran/104143] " cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-104143-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).