From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8346F384B823; Wed, 31 Mar 2021 21:07:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8346F384B823 From: "sgk at troutmask dot apl.washington.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99840] [9/10/11 Regression] ICE in gfc_simplify_matmul, at fortran/simplify.c:4777 Date: Wed, 31 Mar 2021 21:07:47 +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: 11.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: sgk at troutmask dot apl.washington.edu 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: 9.4 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, 31 Mar 2021 21:07:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99840 --- Comment #6 from Steve Kargl -= -- On Wed, Mar 31, 2021 at 08:51:57PM +0000, anlauf at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99840 >=20 > --- Comment #5 from anlauf at gcc dot gnu.org --- > OK, now I see it. gfc_get_shape does not init the resulting shape. > The following simpler patch does the job: >=20 > diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c > index 388aca7c38c..c27b47aa98f 100644 > --- a/gcc/fortran/simplify.c > +++ b/gcc/fortran/simplify.c > @@ -8123,8 +8123,8 @@ gfc_simplify_transpose (gfc_expr *matrix) > &matrix->where); > result->rank =3D 2; > result->shape =3D gfc_get_shape (result->rank); > - mpz_set (result->shape[0], matrix->shape[1]); > - mpz_set (result->shape[1], matrix->shape[0]); > + mpz_init_set (result->shape[0], matrix->shape[1]); > + mpz_init_set (result->shape[1], matrix->shape[0]); >=20 > if (matrix->ts.type =3D=3D BT_CHARACTER) > result->ts.u.cl =3D matrix->ts.u.cl; >=20 The simple patch in comment #2 also works.=