From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D214B3857C76; Wed, 20 Oct 2021 20:58:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D214B3857C76 From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/102787] ICE in new test case gfortran.dg/reshape_shape_2.f90 Date: Wed, 20 Oct 2021 20:58:28 +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: 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: Wed, 20 Oct 2021 20:58:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102787 --- Comment #7 from anlauf at gcc dot gnu.org --- Slightly improved version of the patch of comment#6: diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c index 6552eaf3b0c..a63a6631f59 100644 --- a/gcc/fortran/array.c +++ b/gcc/fortran/array.c @@ -1812,6 +1812,29 @@ expand_constructor (gfc_constructor_base base) continue; } + /* Expand constant array within array constructor. */ + if (e->expr_type =3D=3D EXPR_VARIABLE && e->rank && e->ref + && e->symtree && e->symtree->n.sym + && e->symtree->n.sym->attr.flavor =3D=3D FL_PARAMETER + && e->symtree->n.sym->value + && e->symtree->n.sym->value->value.constructor) + { + gfc_array_ref *ar; + ar =3D gfc_find_array_ref (e); + if (ar && ar->as && ar->as->type =3D=3D AS_EXPLICIT) + { + if (ar->type =3D=3D AR_FULL) + { + gfc_expr *value =3D e->symtree->n.sym->value; + if (!expand_constructor (value->value.constructor)) + return false; + + continue; + } + /* TODO: handle ar->type =3D=3D AR_SECTION. */ + } + } + empty_constructor =3D false; e =3D gfc_copy_expr (e); if (!gfc_simplify_expr (e, 1)) Still does not handle array sections.=