From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CBA9238768A8; Thu, 27 Oct 2022 18:52:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CBA9238768A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666896741; bh=V4VI3bVkakuDbb9IYXaaxOMaKOxs93CWDWi1Z4bAgrs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=an1kE2xltgwPrmR0Et+MmM7o4gkxkwXhl1ZMNUanneCP11uiwtQbm2xEX/ID05pZO A9XHj0fvwu1rBA/X659cVHHZx0ZujfC3qQtV82FyNxf8WL5uTW6NHv8yNUFIeBEPH3 bxHQ5H9sX59iB1bMQpxmJJa7EhbCFTualtiItjE8= From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107441] optional arguments are identified as "present" when missing Date: Thu, 27 Oct 2022 18:52:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cc Message-ID: In-Reply-To: References: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107441 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #2 from kargl at gcc dot gnu.org --- (In reply to anlauf from comment #1) > Confirmed. >=20 > There is an inconsistency either in the generated code for the caller or > the callee: >=20 > integer(kind=3D4) testoptional (character(kind=3D1)[1:1] & restrict w, > integer(kind=3D4) x, integer(kind=3D8) _w, logical(kind=3D1) _x) >=20 > vs. >=20 > t =3D testoptional (&s, 0, 0, 1); >=20 > How does the ABI define the ordering of character length and presence fla= g? Yep, there's an API issue. If you use character(len=3D13) :: s the produced code is t =3D testoptional (&s, 0, 0, 13); so the hidden charlen is tacked on last whereas I think the hidden presence argument is also expected to be last. Likely a counting error in generating the interface.=