From patchwork Mon Sep 27 08:49:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 65820 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 0438AB70E3 for ; Mon, 27 Sep 2010 18:49:25 +1000 (EST) Received: (qmail 21853 invoked by alias); 27 Sep 2010 08:49:23 -0000 Received: (qmail 21843 invoked by uid 22791); 27 Sep 2010 08:49:22 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Sep 2010 08:49:17 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 9EC31A3F67; Mon, 27 Sep 2010 10:49:14 +0200 (CEST) Date: Mon, 27 Sep 2010 10:49:13 +0200 (CEST) From: Richard Guenther To: Jie Zhang Cc: gcc-patches@gcc.gnu.org, "Joseph S. Myers" Subject: Re: [PATCH][C] Always use TRANSLATION_UNIT_DECL as context In-Reply-To: <4C9DE292.7040403@codesourcery.com> Message-ID: References: <4C9DE292.7040403@codesourcery.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 On Sat, 25 Sep 2010, Jie Zhang wrote: > On 09/17/2010 08:18 PM, Richard Guenther wrote: > > * c-decl.c (pop_scope): Always set file-scope DECL_CONTEXT. > > This change causes regressions on arm-none-eabi: > > FAIL: gcc.c-torture/execute/builtins/abs-1.c compilation, -O2 -flto > UNRESOLVED: gcc.c-torture/execute/builtins/abs-1.c execution, -O2 -flto > > The compiler error messages are: > > testsuite/gcc.c-torture/execute/builtins/abs-1.c:22:1: sorry, unimplemented: > gimple bytecode streams do not support machine specific builtin functions on > this target > testsuite/gcc.c-torture/execute/builtins/abs-1-lib.c:22:1: sorry, > unimplemented: gimple bytecode streams do not support machine specific builtin > functions on this target > testsuite/gcc.c-torture/execute/builtins/lib/main.c:13:1: sorry, > unimplemented: gimple bytecode streams do not support machine specific builtin > functions on this target > compiler exited with status 1 > > I did some investigation, but don't know how to fix it. > > The above change makes GCC always set file-scope DECL_CONTEXT. So when come to > > static void > lto_output_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr, > bool ref_p) > { > lto_output_tree_or_ref (ob, DECL_NAME (expr), ref_p); > lto_output_tree_or_ref (ob, DECL_CONTEXT (expr), ref_p); > lto_output_location (ob, DECL_SOURCE_LOCATION (expr)); > } > > with EXPR being a file scope function, DECL_CONEXT (expr) is the translation > unit which contains the function. Then > > lto_output_tree_or_ref (ob, DECL_CONTEXT (expr), ref_p); > > writes out the whole translation unit including all the builtin functions. > Finally, in lto_output_builtin_tree, a "sorry" is called with the above error > message since ARM target does not have targetm.builtin_decl. > > I don't know how to fix this. Defining targetm.builtin_decl for ARM should fix > it. But I'm not sure if we really want to output all builtins for each > translation unit. This regression should exist for all targets which don't > provide targetm.builtin_decl. Yes, this writes all declarations in the TRANSLATION_UNIT_DECLs BLOCK tree. Does the following fix it? Richard. Index: tree.c =================================================================== --- tree.c (revision 164590) +++ tree.c (working copy) @@ -4585,6 +4690,8 @@ free_lang_data_in_decl (tree decl) nesting beyond this point. */ DECL_CONTEXT (decl) = NULL_TREE; } + else if (TREE_CODE (decl) == TRANSLATION_UNIT_DECL) + DECL_INITIAL (decl) = NULL_TREE; }