From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 23E173858C5E; Tue, 22 Aug 2023 08:00:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23E173858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692691213; bh=8dKUFXUg0a8OfD0Di8GL51cey+FZYuFKpLHYRmFGroo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=K4B4pydjHeJYEVxDEdkCQrkLkzJNFtOQXGrJ/PqOx8gX0KebghQ7dApPrW/FeAnp4 Vc1w22SS4hLnvndDti6RYKvSkbqjNJ6/x1ubZsHmws3NTiKMiI0/4B194wnarEjonV Xacf1YETGaHE1CloTRHnQJfO0FJBEfinxvApA5TM= 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: Tue, 22 Aug 2023 08:00:11 +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: 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 --- Comment #6 from Mikael Morin --- (In reply to Mikael Morin from comment #5) > Here sym->formal_ns is NULL because the symbol C has not been completely > setup. This makes the following an "obvious" fix: diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index 8182ef29f43..5afb9f2e2d3 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -7496,6 +7496,7 @@ gfc_match_function_decl (void) sym->attr.module_procedure =3D 1; gfc_new_block =3D sym; + sym->formal_ns =3D gfc_current_ns; m =3D gfc_match_formal_arglist (sym, 0, 0); if (m =3D=3D MATCH_NO) @@ -7993,6 +7994,7 @@ gfc_match_subroutine (void) sym =3D sym->result; gfc_new_block =3D sym; + sym->formal_ns =3D gfc_current_ns; /* Check what next non-whitespace character is so we can tell if there is the required parens if we have a BIND(C). */ However, that patch makes the situation worse by releasing the namespace for "c" too early, as we access it later in reject_statement (it is the "curren= t" namespace).=