From patchwork Thu Jul 14 11:49:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 104667 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 3396DB6F68 for ; Thu, 14 Jul 2011 21:50:15 +1000 (EST) Received: (qmail 24628 invoked by alias); 14 Jul 2011 11:50:14 -0000 Received: (qmail 24619 invoked by uid 22791); 14 Jul 2011 11:50:13 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-fx0-f49.google.com (HELO mail-fx0-f49.google.com) (209.85.161.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Jul 2011 11:49:59 +0000 Received: by fxd20 with SMTP id 20so674744fxd.22 for ; Thu, 14 Jul 2011 04:49:58 -0700 (PDT) Received: by 10.223.71.194 with SMTP id i2mr3459964faj.42.1310644198287; Thu, 14 Jul 2011 04:49:58 -0700 (PDT) Received: from richards-thinkpad (gbibp9ph1--blueice3n2.emea.ibm.com [195.212.29.84]) by mx.google.com with ESMTPS id 28sm100682fax.27.2011.07.14.04.49.56 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jul 2011 04:49:57 -0700 (PDT) From: Richard Sandiford To: "H.J. Lu" Mail-Followup-To: "H.J. Lu" , gcc-patches@gcc.gnu.org, jason@redhat.com, rdsandiford@googlemail.com Cc: gcc-patches@gcc.gnu.org, jason@redhat.com Subject: Re: RFA: Avoid unnecessary clearing in union initialisers References: Date: Thu, 14 Jul 2011 12:49:52 +0100 In-Reply-To: (H. J. Lu's message of "Wed, 13 Jul 2011 09:51:44 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) 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 "H.J. Lu" writes: > This caused: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49736 Sorry for the breakage. It was due to a humiliating stupid mistake in the hunk to update all_zeros_p: @@ -5129,13 +5152,12 @@ mostly_zeros_p (const_tree exp) all_zeros_p (const_tree exp) { if (TREE_CODE (exp) == CONSTRUCTOR) - { - HOST_WIDE_INT nz_elts, count; - bool must_clear; + HOST_WIDE_INT nz_elts, init_elts; + bool complete_p; - categorize_ctor_elements (exp, &nz_elts, &count, &must_clear); - return nz_elts == 0; + categorize_ctor_elements (exp, &nz_elts, &init_elts, &complete_p); + return nz_elts == init_elts; } return initializer_zerop (exp); which was due to trying a different approach and not properly reverting it. I've applied the following as obvious. Tested on x86_64-linux-gnu, and on 255.vortex. Richard gcc/ PR middle-end/49736 * expr.c (all_zeros_p): Undo bogus part of last change. Index: gcc/expr.c =================================================================== --- gcc/expr.c 2011-07-14 11:46:42.000000000 +0100 +++ gcc/expr.c 2011-07-14 11:47:40.000000000 +0100 @@ -5157,7 +5157,7 @@ all_zeros_p (const_tree exp) bool complete_p; categorize_ctor_elements (exp, &nz_elts, &init_elts, &complete_p); - return nz_elts == init_elts; + return nz_elts == 0; } return initializer_zerop (exp);