From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1791 invoked by alias); 24 Mar 2018 21:56:38 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 1762 invoked by uid 89); 24 Mar 2018 21:56:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=HTo:U*jvdelisle X-Spam-User: qpsmtpd, 2 recipients X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 24 Mar 2018 21:56:36 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id w2OLuXun034557 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 24 Mar 2018 14:56:33 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id w2OLuX3P034556; Sat, 24 Mar 2018 14:56:33 -0700 (PDT) (envelope-from sgk) Date: Sat, 24 Mar 2018 21:56:00 -0000 From: Steve Kargl To: Jerry DeLisle Cc: "fortran@gcc.gnu.org" , GCC Patches Subject: Re: [patch,fortran] Bug 69497 - ICE in gfc_free_namespace Message-ID: <20180324215633.GA34452@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <2a78763f-b5e3-2696-78d0-8c808720ba1a@charter.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2a78763f-b5e3-2696-78d0-8c808720ba1a@charter.net> User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00160.txt.bz2 On Sat, Mar 24, 2018 at 02:25:36PM -0700, Jerry DeLisle wrote: > > 2018-03-24 Jerry DeLisle > Dominique d'Humieres > > PR fortran/84506 > * symbol.c (gfc_free_namespace): Delete the assert and if refs > count is less than zero, free the namespece. Something is > halfway and other errors will resound. > > diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c > index ce6b1e93644..997d90b00fd 100644 > --- a/gcc/fortran/symbol.c > +++ b/gcc/fortran/symbol.c > @@ -4037,10 +4037,9 @@ gfc_free_namespace (gfc_namespace *ns) > return; > > ns->refs--; > - if (ns->refs > 0) > - return; > > - gcc_assert (ns->refs == 0); > + if (ns->refs != 0) > + return; > > gfc_free_statements (ns->code); The ChangeLog doesn't seem to match the patch. If ns->refs==0, you free the namespace. If ns->refs!=0, you return. So, if ns->refs<0, the namespace is not freed. -- Steve