From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 987C1385842B; Fri, 1 Oct 2021 18:43:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 987C1385842B From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/102521] ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6240 Date: Fri, 01 Oct 2021 18:43:12 +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: ice-on-valid-code 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: Fri, 01 Oct 2021 18:43:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102521 --- Comment #3 from anlauf at gcc dot gnu.org --- The code works if we replace the r.h.s. in the initialization by an array: program p type t integer :: n end type ! type(t), parameter :: a(4) =3D t(1) ! ICE type(t), parameter :: a(4) =3D spread (t(1), dim=3D1, ncopies=3D4) ! wo= rks type(t), parameter :: c(*) =3D a type(t), parameter :: b(2,2) =3D reshape(a, [2,2]) print *, b end The code in add_init_expr_to_sym looks fishy. We might possibly handle the ICEing code here but don't: 2224 /* Add initializer. Make sure we keep the ranks sane. */ 2225 if (sym->attr.dimension && init->rank =3D=3D 0) 2226 { 2227 mpz_t size; 2228 gfc_expr *array; 2229 int n; 2230 if (sym->attr.flavor =3D=3D FL_PARAMETER 2231 && init->expr_type =3D=3D EXPR_CONSTANT 2232 && spec_size (sym->as, &size) 2233 && mpz_cmp_si (size, 0) > 0) (gdb) p init->expr_type $1 =3D EXPR_STRUCTURE=