From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8F7D53858D32; Mon, 10 Jul 2023 18:15:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F7D53858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689012927; bh=tSvb23/xO1zMu+ktXU0vIqcvic6FbVNa59YpHdpQQq8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hiAbHwisr2lte2zJRWgmdlHL+ATYuK7/DImtv3dgPknl1/7qzUwWPNzmlZD21fnzJ 4SepewGV8r5bwTP/PCMJ64DIeIbSSOrZ3reRcLMi/4bhYpxzpS92IzXQAYCFka9Ir4 XF07UlD59fdDLCyYDOmEXbEF3oObczuAjtFp5lRg= From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/106050] ICE in reject_statement, at fortran/parse.cc:2879 since r8-3056-g5bab4c9631c478b7 Date: Mon, 10 Jul 2023 18:15:27 +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: mikael 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: cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106050 Mikael Morin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #5 from Mikael Morin --- When matching statement "type t(k)", two symbols are created, one for t and= one for k. t is in gfc_current_ns and k is in t's f2k_derived namespace. If the statement is rejected, both t and k need to be freed. But one should care about ordering, as the release of t frees f2k_derived, which is k's namespace, so k should be released before t. I haven't checked that the above actually is the problem here, but it might= be. Possibly walking the symbols in reverse order to release them would fix thi= s. Regarding the patches posted, if sym->refs < 0 is true, then the memory for= sym has already been released and may be garbage (including sym->refs). A cras= h is as good as anything else at this point IMHO.=