From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 709BD3858D38; Fri, 14 Oct 2022 19:07:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 709BD3858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665774439; bh=oeesbzLIEjTt2ACwZ7Xf+o5GAimhz22Zt2APi7Oh1nc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=g2HeP7PhO82pMSvtc/WkvBjz7umbJUkvs1YxvgJWQ3EiXIpbDtRW9R9+6vQIMAQof V9EJZjCUCiaOysWPQj+KnLyDUxm2YQ04TUL9XHiu/ZTTEq3jY4DFRwgtmzkNqNr2kL we35yniXvovCjwz3FG9u0BySvESgZwCp168J6E6g= From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/93483] ICE in gfc_constructor_copy, at fortran/constructor.c:103 Date: Fri, 14 Oct 2022 19:06:40 +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: 10.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: anlauf 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=3D93483 --- Comment #17 from Mikael Morin --- There is the possibility to bail out at the very point where things are abo= ut to go wrong, and hope that at resolution time simplification will happen. Like this for the first part of the test from the patch: diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc index 9e079e42995..5e96bb9658e 100644 --- a/gcc/fortran/arith.cc +++ b/gcc/fortran/arith.cc @@ -1267,6 +1267,9 @@ reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **), gfc_expr *op, if (op->expr_type =3D=3D EXPR_CONSTANT) return eval (op, result); + if (op->expr_type !=3D EXPR_ARRAY) + return ARITH_INVALID_TYPE; + rc =3D ARITH_OK; head =3D gfc_constructor_copy (op->value.constructor); for (c =3D gfc_constructor_first (head); c; c =3D gfc_constructor_next (= c)) And something similar for the rest of the test (the binary operators).=