From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4CDB738582B4; Tue, 5 Jul 2022 19:21:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CDB738582B4 From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/106209] ICE in add_init_expr_to_sym, at fortran/decl.cc:2132 Date: Tue, 05 Jul 2022 19:21:09 +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: kargl at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status everconfirmed cc priority 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: Tue, 05 Jul 2022 19:21:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106209 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-07-05 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 CC| |kargl at gcc dot gnu.org Priority|P3 |P4 --- Comment #1 from kargl at gcc dot gnu.org --- Instead of an assert(), simply return false to give gfortran a chance to em= it an error. % gfcx -c a.f90 a.f90:3:4: 3 | integer, parameter :: b(*) =3D a | 1 Error: Unclassifiable statement at (1) a.f90:2:29: 2 | integer, parameter :: a(:) =3D 0 | 1 Error: Parameter array 'a' at (1) cannot be automatic or of deferred shape diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index bd586e75008..cec178fc80b 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -2129,7 +2129,9 @@ add_init_expr_to_sym (const char *name, gfc_expr **in= itp, locus *var_locus) /* The shape may be NULL for EXPR_ARRAY, set it. */ if (init->shape =3D=3D NULL) { - gcc_assert (init->expr_type =3D=3D EXPR_ARRAY); + if (init->expr_type !=3D EXPR_ARRAY) + return false; + init->shape =3D gfc_get_shape (1); if (!gfc_array_size (init, &init->shape[0])) gfc_internal_error ("gfc_array_size failed");=