From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2D7E23858C53; Mon, 26 Sep 2022 21:37:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2D7E23858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664228278; bh=tEn/DntzEedjp0Aak6wWWQhsgHg41OWYr7rdkC4fiMw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lGKGVhsOXYCw+qd1kDmAu+uvC+UMgjAPQIgQNVuaHtOikcshSDfii+RIIxYtBpjbP 7IJX5jD9fi3lw4ZowimBc+5R8rGY18Daqe8ZosIV+HWwrQ9ptcqbtywuu2udv22TYA a+u/ngrYToU02LqMKKyzuftcHZqec2XlD9i3ZLbU= From: "sgk at troutmask dot apl.washington.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107000] ICE in gfc_real2complex, at fortran/arith.cc:2243 Date: Mon, 26 Sep 2022 21:37:57 +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: sgk at troutmask dot apl.washington.edu 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 #6 from Steve Kargl -= -- On Mon, Sep 26, 2022 at 08:38:56PM +0000, anlauf at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107000 >=20 > --- 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 t= hat > > the EXPR_OP of type_expr is allowing the array constructor walk to succ= eed. >=20 > You mean sth. like: >=20 > 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= _OP)) > return MATCH_ERROR; > } > return MATCH_YES; >=20 > in addition to the fix from comment#2? This works and regtests ok. >=20 Yes, that would work! I was thinking of something more complex such as looking at the types of the operand(s), but simplification probably handles +1 and -1 correctly and punts on +'1' and -'1'.=