From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 154E73858C60; Tue, 22 Aug 2023 08:14:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 154E73858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692692086; bh=5LCbYf7fSNnJBTyIqyliMzfWJHgExYvtzIp0pSL6S9g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DsSw/ZzqrtpN5fjwJ8kmI5eQclO0P75qOLxye8Zg4YeepyMzYzckjYinSuJIbBG8a jXQkOcNbdNuTW0COX634BaaJOSLllJ2yF+Sy2CsEPADaN6NecOyNtgkE45eO+95D23 7H6mId7WBsyG06mirQQh2g8teg1rZ9A8TkKARbZk= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/110996] RISC-V vector Fortran: SEGV ICE during parsing Date: Tue, 22 Aug 2023 08:14:44 +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: juzhe.zhong at rivai dot ai 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 #7 from JuzheZhong --- (In reply to Mikael Morin from comment #6) > (In reply to Mikael Morin from comment #5) > > Here sym->formal_ns is NULL because the symbol C has not been completely > > setup. >=20 > This makes the following an "obvious" fix: >=20 > 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; >=20=20 > gfc_new_block =3D sym; > + sym->formal_ns =3D gfc_current_ns; >=20=20 > 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; >=20=20 > gfc_new_block =3D sym; > + sym->formal_ns =3D gfc_current_ns; >=20=20 > /* Check what next non-whitespace character is so we can tell if there > is the required parens if we have a BIND(C). */ >=20 >=20 > 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 > "current" namespace). Thanks for helping with this issue.=20 Do you have a solution that we can fix RISC-V backend? Or you will fix it in Fortran front-end? Thanks.=