public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95446] New: False positive for optional arguments of elemental procedure
@ 2020-05-30 22:45 m.diehl at mpie dot de
  2020-05-31  4:02 ` [Bug fortran/95446] " kargl at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: m.diehl at mpie dot de @ 2020-05-30 22:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95446
           Summary: False positive for optional arguments of elemental
                    procedure
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.diehl at mpie dot de
  Target Milestone: ---

to my understanding, the following code is valid

program elemental_optional
  implicit none
  integer :: m(5), r(5)

  m = 1

  r = outer()
  r = outer(m)

  contains

  function outer(o) result(l)
    integer, intent(in), optional :: o(:)
    integer :: u(5), l(5)

    l = inner(o,u)

  end function outer

  elemental function inner(a,b) result(x)
    integer, intent(in), optional :: a
    integer, intent(in) :: b
    integer :: x

    if(present(a)) then
      x = a*b
    else
      x = b
    endif
  end function inner

end program elemental_optional

however, when compiling with "-pedantic-errors", the following error message
shows up:

Error: ‘o’ at (1) is an array and OPTIONAL; IF IT IS MISSING, it cannot be the
actual argument of an ELEMENTAL procedure unless there is a non-optional
argument with the same rank (12.4.1.5) [-Werror=pedantic]

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

end of thread, other threads:[~2020-07-02  7:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30 22:45 [Bug fortran/95446] New: False positive for optional arguments of elemental procedure m.diehl at mpie dot de
2020-05-31  4:02 ` [Bug fortran/95446] " kargl at gcc dot gnu.org
2020-05-31  7:13 ` m.diehl at mpie dot de
2020-06-09 10:48 ` dominiq at lps dot ens.fr
2020-07-01 14:40 ` cvs-commit at gcc dot gnu.org
2020-07-02  7:24 ` markeggleston 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).