From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0AD5538930D6; Sat, 30 May 2020 22:45:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AD5538930D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590878753; bh=XDXeB7DtgStloJEfVfKxnoEs0OoqS6LQO2HanVvVg3c=; h=From:To:Subject:Date:From; b=XlP0fbV137UpsdJaxhMNPatSOHByr0gwQS+HPohVp/T6KsiFOtpeK4KozDFqu0k0c iF0/aIQ62E3huzgQsVdSkQBFcJ4uoRA7CW9pBTY/QoBGPpTGiVtyHd/B/k5XywzakM IzXBYDiFR4X2Vjy2Q1AD18B/pTDnxY2by7J5nuZA= From: "m.diehl at mpie dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/95446] New: False positive for optional arguments of elemental procedure Date: Sat, 30 May 2020 22:45:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: m.diehl at mpie dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2020 22:45:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95446 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 =3D 1 r =3D outer() r =3D outer(m) contains function outer(o) result(l) integer, intent(in), optional :: o(:) integer :: u(5), l(5) l =3D 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 =3D a*b else x =3D b endif end function inner end program elemental_optional however, when compiling with "-pedantic-errors", the following error message shows up: Error: =E2=80=98o=E2=80=99 at (1) is an array and OPTIONAL; IF IT IS MISSIN= G, 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=3Dpedantic]=