From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 97E013858D34; Fri, 5 Apr 2024 17:18:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 97E013858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712337524; bh=u99KFiXoajhWR31GO5beumJ/xtYrTugKV5kBKLEXC60=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ibc7m0zS2iw7qYtkdeGdLSa2ssFYtXEF6R/L8QgRpIhvklLqrrpRp/PxUo0/6S+Ge GwAsP8vCOGtTokP5EexTQGeVBWa0NyC7tWvUf/xih6SDZPoUyrezHC1fOhct0Dgp+M m2nLHoyJXe/26MKG211Ic+ZApSn372ylDW+fY6V4= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/106500] ICE on function as an argument to c_sizeof() Date: Fri, 05 Apr 2024 17:18:42 +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.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords 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=3D106500 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code CC| |anlauf at gcc dot gnu.org --- Comment #4 from anlauf at gcc dot gnu.org --- I've looked some time into this and have the impression we have the checks wrong. E.g. testcase gfortran.dg/c_sizeof_6.f90 expects as error: gcc/testsuite/gfortran.dg/c_sizeof_6.f90:11:16: 11 | i =3D c_sizeof(str2(1:3)) ! { dg-error "must be an interoperable= data" } | 1 Error: 'x' argument of 'c_sizeof' intrinsic at (1) must be an interoperable data entity: Only whole-arrays are interoperable First, other compilers accept the code (Intel, NAG, Nvidia, flang), and also the other testcases in the PR, plus they give the expected answers. Second, the standard has: ! F2023:18.2.3.8 C_SIZEOF (X) ! ! X shall be a data entity with interoperable type and type parameters, ! and shall not be an assumed-size array, an assumed-rank array that ! is associated with an assumed-size array, an unallocated allocatable ! variable, or a pointer that is not associated. and ! 3.41 data entity ! data object, result of the evaluation of an expression, or the ! result of the execution of a function reference So, array sections could be interoperable, expressions, function results. What is unclear to me: when is an expression interoperable? Or rather when is it *not*? (Note that the standard text has not essentially changed since F2008, so we got this too strict from the beginning.)=