From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117355 invoked by alias); 16 Jun 2016 14:37:59 -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 117336 invoked by uid 89); 16 Jun 2016 14:37:59 -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,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: smtp.ispras.ru Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.199.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Jun 2016 14:37:55 +0000 Received: from [10.10.3.121] (unknown [83.149.199.91]) by smtp.ispras.ru (Postfix) with ESMTP id CD4152040E; Thu, 16 Jun 2016 17:37:52 +0300 (MSK) Date: Thu, 16 Jun 2016 14:37:00 -0000 From: Alexander Monakov To: Jan Hubicka cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Handle undefined extern vars in output_in_order In-Reply-To: <20160616142524.GA93274@kam.mff.cuni.cz> Message-ID: References: <20160616142524.GA93274@kam.mff.cuni.cz> User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2016-06/txt/msg01243.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? Thanks. Alexander