From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C2CB6385624C; Thu, 17 Aug 2023 19:49:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2CB6385624C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692301798; bh=W13XG0/F+1RcVm7Ci4CvI/yf4gD53mU8JbW0xzr23qo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GjzakVBmYVmeVenMz85x+NDfDIqxMkjSf2KFjQDSGXeQhZljcmkWCNbbRbtG9lesb RWVdkWsFZy6Fh2WpK8PmwNmiUGj8rYWjOmtB1elbukEO3LucGJZUYwCifkTD8wal8J sUAqZCmOBuq8+b7w9vlyEFKfSo4Wl61kuuZZh0RU= From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/110996] RISC-V vector Fortran: SEGV ICE during parsing Date: Thu, 17 Aug 2023 19:49:57 +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: 14.0 X-Bugzilla-Keywords: error-recovery X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael 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: everconfirmed bug_status cf_reconfirmed_on 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=3D110996 Mikael Morin changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-08-17 CC| |mikael at gcc dot gnu.org --- Comment #5 from Mikael Morin --- Confirmed on the reduced example from comment #2. The problem arises because of the bogus subroutine statement: SUBROUTINE c(d) e This is rejected and symbols C and D should be released (no symbol has been built for E at the time the statement is rejected). D is released, but C is not, and it keeps a pointer to D through it's formal field. BOOM. The reason C is not released is its reference count is 2 and the condition = to break cycles at the beginning of gfc_release_symbol doesn't hold: 3118 if (sym->formal_ns !=3D NULL && sym->refs =3D=3D 2 && sym->formal_ns = !=3D sym->ns 3119 && (!sym->attr.entry || !sym->module)) Here sym->formal_ns is NULL because the symbol C has not been completely se= tup.=