From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0B68A3850422; Tue, 16 Mar 2021 21:32:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B68A3850422 From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99138] ICE in gfc_match_rvalue, at fortran/primary.c:3738 Date: Tue, 16 Mar 2021 21:32: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: 11.0 X-Bugzilla-Keywords: ice-on-invalid-code, 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: 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: Tue, 16 Mar 2021 21:32:55 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99138 --- Comment #8 from anlauf at gcc dot gnu.org --- The check in interface.c:gfc_check_result_characteristics has an asymmetry coming from symbol.c:gfc_type_compatible that could be evaded by swapping arguments: diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index f7ca52e6550..8758f146d57 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -1561,7 +1561,7 @@ gfc_check_result_characteristics (gfc_symbol *s1, gfc_symbol *s2, return true; /* Check type and rank. */ - if (!compare_type_characteristics (r1, r2)) + if (!compare_type_characteristics (r2, r1)) { snprintf (errmsg, err_len, "Type mismatch in function result (%s/%s)= ", gfc_typename (&r1->ts), gfc_typename (&r2->ts)); However, we then hits other issues later on with the ALLOCATABLE attribute. :-(=