From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 976D8385AE58; Tue, 25 Oct 2022 20:22:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 976D8385AE58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666729375; bh=es0YAqA5d3bTZ99BstzbrtBdddb+QucO+5xZQJcnQEM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=V9JoTvrhpKhHdKfkgxjKUhWrXersoVj4VPPeN+944RqLVQc1ozYHqQ/9cSSzkY9dy nw7+s3xwWCNPpG4e3ZnufzKS5fgVZ34tQp2mvOqE+OYehph7BSwvnD8ORHFXw+VUPG WQC1VHU1RXtoaMvFy7GQ98UsTiPdjETUB8ZLLq3s= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/103413] [10/11/12/13 Regression] ICE: Invalid expression in gfc_element_size since r10-2083-g8dc63166e0b85954 Date: Tue, 25 Oct 2022 20:22:54 +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-invalid-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: 10.5 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=3D103413 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #9 from anlauf at gcc dot gnu.org --- Steve, what do you think about the following patch? Not yet fully regtested. It should fix the issue much simpler by checking type compatibility: diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc index 6050359d521..f4052eb7042 100644 --- a/gcc/fortran/symbol.cc +++ b/gcc/fortran/symbol.cc @@ -5139,6 +5141,9 @@ gfc_type_compatible (gfc_typespec *ts1, gfc_typespec *ts2) bool is_union1 =3D (ts1->type =3D=3D BT_UNION); bool is_union2 =3D (ts2->type =3D=3D BT_UNION); + if (ts2->type =3D=3D BT_BOZ) + return (ts1->type =3D=3D BT_INTEGER || ts1->type =3D=3D BT_REAL); + if (is_class1 && ts1->u.derived->components && ((ts1->u.derived->attr.is_class Do you have a testcase that exercises BT_INTEGER and BT_REAL here? I thought that one of the pathes that reaches gfc_boz2int and gfc_boz2real might need the above.=