From patchwork Thu Sep 9 00:05:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 64246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 09E3CB70A3 for ; Thu, 9 Sep 2010 10:06:11 +1000 (EST) Received: (qmail 4316 invoked by alias); 9 Sep 2010 00:06:04 -0000 Received: (qmail 4278 invoked by uid 22791); 9 Sep 2010 00:05:58 -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-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Sep 2010 00:05:23 +0000 Received: from localhost (occam.ms.mff.cuni.cz [195.113.18.121]) by nikam.ms.mff.cuni.cz (Postfix) with ESMTP id 0984B9AC29B for ; Thu, 9 Sep 2010 02:05:21 +0200 (CEST) Received: by localhost (Postfix, from userid 16202) id 0367956415F; Thu, 9 Sep 2010 02:05:21 +0200 (CEST) Date: Thu, 9 Sep 2010 02:05:20 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix LTO ICE introduced by ggc_collect patch Message-ID: <20100909000520.GC21068@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, we currently ICE compiling larger files because file_decl_data gets garbage collected. Comitting as obvoius so periodic testing can continue. Bootstrapped/regtested x86_64-linux and tested and we can build Mozilla again. Honza * lto.c (real_file_count, real_file_decl_data): New static vars. (read_cgraph_and_symbols): Use it. + real_file_decl_data + = decl_data = ggc_alloc_cleared_vec_lto_file_decl_data_ptr (nfiles + 1); + real_file_count = nfiles; /* Read the resolution file. */ resolution = NULL; @@ -1794,7 +2052,8 @@ lto_flatten_files (decl_data, count, last_file_ix); lto_stats.num_input_files = count; - free(decl_data); + ggc_free(decl_data); + real_file_decl_data = NULL; if (resolution_file_name) fclose (resolution); Index: lto/lto.c =================================================================== --- lto/lto.c (revision 164010) +++ lto/lto.c (working copy) @@ -760,12 +760,8 @@ @@ -1726,6 +1977,11 @@ gcc_assert (k == count); } +/* Input file data before flattening (i.e. splitting them to subfiles to support + incremental linking. */ +static int real_file_count; +static GTY((length ("real_file_count + 1"))) struct lto_file_decl_data **real_file_decl_data; + /* Read all the symbols from the input files FNAMES. NFILES is the number of files requested in the command line. Instantiate a global call graph by aggregating all the sub-graphs found in each @@ -1744,7 +2000,9 @@ timevar_push (TV_IPA_LTO_DECL_IN); - decl_data = (struct lto_file_decl_data **)xmalloc (sizeof(*decl_data) * (nfiles+1));