From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9E3653858000; Mon, 1 Aug 2022 19:47:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E3653858000 From: "kargl 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: Mon, 01 Aug 2022 19:47:31 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl at gcc dot gnu.org 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: 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: Mon, 01 Aug 2022 19:47:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106500 --- Comment #1 from kargl at gcc dot gnu.org --- Changed subject as it's unclear whether it is invalid or not. In any case,= =20 this patch allows the code to compile and it produces the expected output. % gfcx -o z a.f90 % ./z 4 16 diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc index 0c2cb50c6a7..b9d460f133e 100644 --- a/gcc/fortran/check.cc +++ b/gcc/fortran/check.cc @@ -5266,6 +5266,9 @@ is_c_interoperable (gfc_expr *expr, const char **msg, bool c_loc, bool c_f_ptr) return false; } + if ( expr->expr_type =3D=3D EXPR_FUNCTION) + return true; + if (!c_loc && expr->rank > 0 && expr->expr_type !=3D EXPR_ARRAY) { gfc_array_ref *ar =3D gfc_find_array_ref (expr);=