From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73957 invoked by alias); 16 Jun 2016 15:24:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 73942 invoked by uid 89); 16 Jun 2016 15:24:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 16 Jun 2016 15:24:06 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 789DB5452D5; Thu, 16 Jun 2016 17:24:03 +0200 (CEST) Date: Thu, 16 Jun 2016 15:24:00 -0000 From: Jan Hubicka To: Alexander Monakov Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Handle undefined extern vars in output_in_order Message-ID: <20160616152403.GA38925@kam.mff.cuni.cz> References: <20160616142524.GA93274@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2016-06/txt/msg01247.txt.bz2 > On Thu, 16 Jun 2016, Jan Hubicka wrote: > > > On Thu, 9 Jun 2016, Alexander Monakov wrote: > > + FOR_EACH_VARIABLE (pv) > [snip] > > + i = pv->order; > > + gcc_assert (nodes[i].kind == ORDER_UNDEFINED); > > + nodes[i].kind = pv->definition ? ORDER_VAR : ORDER_VAR_UNDEF; > > + nodes[i].u.v = pv; > > > > order for undefined variables is not computed, so it will be 0. Doesn't > > think overwrite existing entries of nodes array? > > Hm, I've tried the following testcase: > > extern int a, b; > int f() > { > return a+b; > } > > and in the above loop I see pv->order == 2 on the first iteration, > pv->order == 1 on the second. Under what circumstances wouldn't > order be computed? I see, order is created at a time variable is added to symbol table (not at time when definition is given). So we should have order everywhere. Patch is OK Honza > > Thanks. > Alexander