From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25383 invoked by alias); 3 May 2011 16:46:33 -0000 Received: (qmail 25370 invoked by uid 22791); 3 May 2011 16:46:32 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 16:46:16 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id C3AE39AC87B; Tue, 3 May 2011 18:46:14 +0200 (CEST) Date: Tue, 03 May 2011 16:46:00 -0000 From: Jan Hubicka To: Xinliang David Li , ebotcazou@adacore.com Cc: Jan Hubicka , GCC Patches Subject: Re: [google]: initialize language field for clone function struct Message-ID: <20110503164614.GB18705@kam.mff.cuni.cz> References: <20110503105537.GA26000@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.18 (2008-05-17) 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 X-SW-Source: 2011-05/txt/msg00196.txt.bz2 > In fold-const.c, there are many of calls to > lang_hooks.decls.global_bindings_p, and the implementation of this in > name-lookup.h will look at the the cfun->language > > > #define cp_function_chain (cfun->language) > > #define current_binding_level \ > (*(cfun && cp_function_chain && cp_function_chain->bindings \ > ? &cp_function_chain->bindings \ > > int > global_bindings_p (void) > { > return global_scope_p (current_binding_level); > } > > > In gcc 4.4.3, current_binding_level is defined in a way that > cp_function_chain->bindings is not guarded, resulting in segfault for > clones. In trunk, this is guarded -- but not setting language field > for clone probably just hide the problem. Indeed, it seems to me that global_bindings_p should go, clearly the LTO does not preserve its behaviour in any sane way. I am however completely missing the point of this langhook and doc is not exactly informative either: /* Returns nonzero if we are in the global binding level. Ada returns -1 for an undocumented reason used in stor-layout.c. */ What is the purpose of this hook? Honza