From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0A0CB385840C; Fri, 28 Jan 2022 21:19:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A0CB385840C From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104228] [9/10/11/12 Regression] ICE in df_install_ref, at df-scan.cc:2294 since r8-3589-g707905d0773e5a8e Date: Fri, 28 Jan 2022 21:19:31 +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-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mikael at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc assigned_to bug_status 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, 28 Jan 2022 21:19:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104228 Mikael Morin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |mikael at gcc dot g= nu.org Status|NEW |ASSIGNED --- Comment #6 from Mikael Morin --- The full typespec is copied from the associate target (x) to the associate symbol (y) at parse.cc:4925. This includes the character length object, wh= ich starting from there is shared between x and y. None of the various conditi= ons are met in resolve_assoc_var to overwrite the character length object. So = when we create the length decl (.y) for y and store it in its character length object, it also appears in that of x at the same time. And from there it is added to both functions along a path that I have lost. Draft patch: diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 835a4783718..266e41e25b1 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -9227,7 +9227,6 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_targ= et) sym->ts.u.cl =3D target->ts.u.cl; if (sym->ts.deferred && target->expr_type =3D=3D EXPR_VARIABLE - && target->symtree->n.sym->attr.dummy && sym->ts.u.cl =3D=3D target->ts.u.cl) { sym->ts.u.cl =3D gfc_new_charlen (sym->ns, NULL);=