From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19790 invoked by alias); 3 May 2011 16:15:28 -0000 Received: (qmail 19776 invoked by uid 22791); 3 May 2011 16:15:26 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 16:15:12 +0000 Received: from wpaz24.hot.corp.google.com (wpaz24.hot.corp.google.com [172.24.198.88]) by smtp-out.google.com with ESMTP id p43GFAOW013905 for ; Tue, 3 May 2011 09:15:10 -0700 Received: from yic13 (yic13.prod.google.com [10.243.65.141]) by wpaz24.hot.corp.google.com with ESMTP id p43GF88U018058 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 3 May 2011 09:15:09 -0700 Received: by yic13 with SMTP id 13so124517yic.17 for ; Tue, 03 May 2011 09:15:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.165.12 with SMTP id n12mr180783ybe.16.1304439308725; Tue, 03 May 2011 09:15:08 -0700 (PDT) Received: by 10.150.192.11 with HTTP; Tue, 3 May 2011 09:15:08 -0700 (PDT) In-Reply-To: <20110503105537.GA26000@kam.mff.cuni.cz> References: <20110503105537.GA26000@kam.mff.cuni.cz> Date: Tue, 03 May 2011 16:15:00 -0000 Message-ID: Subject: Re: [google]: initialize language field for clone function struct From: Xinliang David Li To: Jan Hubicka Cc: GCC Patches Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes 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/msg00193.txt.bz2 On Tue, May 3, 2011 at 3:55 AM, Jan Hubicka wrote: >> Is this one ok? > Hi, > we did quite some work on removing a langhooks for LTO, where they become= quite impossible > So I would like to know what testcase causes the problem and why. 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. Thanks, David > > Honza >> >> David >> >> On Fri, Apr 29, 2011 at 4:38 PM, Xinliang David Li = wrote: >> > During function cloning, the language field of the src func is not >> > copied. This can lead to null dereference when gcc calls into langhook >> > functions. =A0Unfortunately, I lost track of the test case. >> > >> > Ok for trunk ? >> > >> > Thanks, >> > >> > David >> > >> > >> > 2011-04-29 =A0Xinliang David Li =A0 >> > >> > =A0 =A0 =A0 =A0* tree-inline.c (ininitialize_cfun): Initialize >> > =A0 =A0 =A0 =A0language field for clone cfun. >> > >