From patchwork Wed Nov 9 08:31:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 124489 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 A0ECE1007D7 for ; Wed, 9 Nov 2011 19:31:17 +1100 (EST) Received: (qmail 4097 invoked by alias); 9 Nov 2011 08:31:15 -0000 Received: (qmail 4087 invoked by uid 22791); 9 Nov 2011 08:31:14 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, 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; Wed, 09 Nov 2011 08:31:01 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 2CF5C8980B for ; Wed, 9 Nov 2011 09:31:00 +0100 (CET) Date: Wed, 9 Nov 2011 09:31:00 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fixup canonicalize_constructor_val some more Message-ID: 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 Make sure to mark decl addresses coming from constructors as addressable (otherwise early folding fails for all java testcases). Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2011-11-09 Richard Guenther * gimple-fold.c (canonicalize_constructor_val): Mark address-taken variables addressable. Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 181173) +++ gcc/gimple-fold.c (working copy) @@ -137,9 +137,12 @@ canonicalize_constructor_val (tree cval) || TREE_CODE (base) == FUNCTION_DECL) && !can_refer_decl_in_current_unit_p (base)) return NULL_TREE; - if (cfun && gimple_referenced_vars (cfun) - && base && TREE_CODE (base) == VAR_DECL) - add_referenced_var (base); + if (base && TREE_CODE (base) == VAR_DECL) + { + TREE_ADDRESSABLE (base) = 1; + if (cfun && gimple_referenced_vars (cfun)) + add_referenced_var (base); + } /* Fixup types in global initializers. */ if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0))) cval = build_fold_addr_expr (TREE_OPERAND (cval, 0));