From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9CCB43858403; Sat, 13 Nov 2021 21:15:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CCB43858403 From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/102368] Failure to compile program using the C_SIZEOF function in ISO_C_BINDING Date: Sat, 13 Nov 2021 21:15:14 +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: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: anlauf at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status 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 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, 13 Nov 2021 21:15:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102368 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |WAITING --- Comment #5 from anlauf at gcc dot gnu.org --- The relevant F2018 standard excerpts are: 18.2.3.7 C_SIZEOF (X) [...] Argument. X shall be an interoperable data entity ... 3.45 data entity data object, result of the evaluation of an expression, or the result of the execution of a function reference 3.46 data object constant (7.1.4), variable (9), or subobject of a constant (5.4.3.2.4) 3.92 interoperable =E2=9F=A8Fortran entity=E2=9F=A9 equivalent to an entity defined by or defi= nable by the companion processor (18.3) 18.3.1 Interoperability of intrinsic types Table 18.2 shows the interoperability between Fortran intrinsic types and C types. A Fortran intrinsic type with particular type parameter values is interoperable with a C type if the type and kind type parameter value are listed in the table on the same row as that C type. If the type is character, the length type parameter is interoperable if and only if its value is one. ... 18.3.4 Interoperability of scalar variables A named scalar Fortran variable is interoperable if and only if its type and type parameters are interoperable, [...], and if it is of type character its length is not assumed or declared by an expression that is not a constant expression. An interoperable scalar Fortran variable is interoperable with a scalar C entity if their types and type parameters are interoperable. I understand Steve's comment that the length has to be constant and one. If this is the common understanding, the current PR would be invalid.=