From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E070F3860C3E; Mon, 14 Jun 2021 16:08:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E070F3860C3E From: "jrfsousa at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/100683] Array initialization refuses valid Date: Mon, 14 Jun 2021 16:08:25 +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: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: jrfsousa at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jrfsousa 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: Mon, 14 Jun 2021 16:08:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100683 --- Comment #7 from Jos=C3=A9 Rui Faustino de Sousa --- I was using pr87993.f90 from the testsuite... ;-) The fix is simple enough: diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index a37ad66..a9518e7 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -7138,8 +7138,10 @@ gfc_resolve_expr (gfc_expr *e) /* Also try to expand a constructor. */ if (t) { + gfc_simplify_expr(e, 1); gfc_expression_rank (e); - if (gfc_is_constant_expr (e) || gfc_is_expandable_expr (e)) + if (e->expr_type =3D=3D EXPR_ARRAY + && (gfc_is_constant_expr (e) || gfc_is_expandable_expr (e))) gfc_expand_constructor (e, false); } I really should have though of this possibility... Thank you very much. Best regards, Jos=C3=A9 Rui=