From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1F4DC3858CDA; Mon, 26 Sep 2022 20:38:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F4DC3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664224737; bh=aSJjYAuzhHxDSixsUx5Mjt0UFwMp0uHBeNcFqxyjAtQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=T12fFGkYHf5UMGmlPVPAuIAecp5oOlE23erlbToocHnACfOJhf/UbAXxv9TMZ51sI bxjzuFUCHjKvTvra2NQV2RQ2SID3/lqGYuoWsxavfvZ3JiaVWWiiQnTfuTLp/IvVxH +EYdXz7A1K2FuS0DCXBB92oj2Iu9bi5i9oZJeG7Y= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107000] ICE in gfc_real2complex, at fortran/arith.cc:2243 Date: Mon, 26 Sep 2022 20:38:56 +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: 13.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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107000 --- Comment #5 from anlauf at gcc dot gnu.org --- (In reply to kargl from comment #4) > I think we need to expand the checking in array.cc >=20 > /* Convert components of an array constructor to the type in ts. */ >=20 > static match > walk_array_constructor (gfc_typespec *ts, gfc_constructor_base head) >=20 > I haven't had time to look deeper, but this function should be comparing > the typespecs of REAL and -'1' or +'1'. That should fail. I suspect that > the EXPR_OP of type_expr is allowing the array constructor walk to succee= d. You mean sth. like: diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc index bbdb5b392fc..78a15917cec 100644 --- a/gcc/fortran/array.cc +++ b/gcc/fortran/array.cc @@ -1213,7 +1213,7 @@ walk_array_constructor (gfc_typespec *ts, gfc_constructor_base head) return m; } else if (!gfc_convert_type_warn (e, ts, 1, 1, true) - && e->ts.type !=3D BT_UNKNOWN) + && (e->ts.type !=3D BT_UNKNOWN || e->expr_type =3D=3D EXPR_O= P)) return MATCH_ERROR; } return MATCH_YES; in addition to the fix from comment#2? This works and regtests ok.=