public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104143] New: [F2018] Accept scalar actual arguments to assumed-type assumed-size array dummies [type(*), dimension(*)]
@ 2022-01-20  8:43 burnus at gcc dot gnu.org
  2022-09-20 21:06 ` [Bug fortran/104143] " cvs-commit at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-01-20  8:43 UTC (permalink / raw)
  To: gcc-bugs

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.)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/104143] [F2018] Accept scalar actual arguments to assumed-type assumed-size array dummies [type(*), dimension(*)]
  2022-01-20  8:43 [Bug fortran/104143] New: [F2018] Accept scalar actual arguments to assumed-type assumed-size array dummies [type(*), dimension(*)] burnus at gcc dot gnu.org
@ 2022-09-20 21:06 ` cvs-commit at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-20 21:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:59f6dea963b5f7a6b9ced325200359b4831e7fa7

commit r13-2748-g59f6dea963b5f7a6b9ced325200359b4831e7fa7
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Sep 20 23:06:19 2022 +0200

    Fortran: F2018 type(*),dimension(*) with scalars [PR104143]

    Assumed-size dummy arguments accept arrays and array elements as actual
    arguments. There are also a few exceptions when real scalars are permitted.
    Since F2018, this includes scalar arguments to assumed-type dummies; while
    type(*) was added in TS29113, this change is only in F2018 itself.

            PR fortran/104143

    gcc/fortran/ChangeLog:

            * interface.cc (compare_parameter): Permit scalar args to
            'type(*), dimension(*)'.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/c-interop/c407b-2.f90: Remove dg-error.
            * gfortran.dg/assumed_type_16.f90: New test.
            * gfortran.dg/assumed_type_17.f90: New test.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-20 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20  8:43 [Bug fortran/104143] New: [F2018] Accept scalar actual arguments to assumed-type assumed-size array dummies [type(*), dimension(*)] burnus at gcc dot gnu.org
2022-09-20 21:06 ` [Bug fortran/104143] " cvs-commit at gcc dot gnu.org

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).