From patchwork Wed Feb 27 15:08:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 223628 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 0FEF02C007A for ; Thu, 28 Feb 2013 02:08:32 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1362582514; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:Mail-Followup-To:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=tWU48kRxNn0UAy1wXwzT6BuLh9c=; b=mkFuFmaP9roFg8XcY+/UcX6lW9H7mLFkaRtnDIKbrNBoBkVhzFcxnAtxq7Y7iz LPzg+V2YqdP5Ar9xdQoOQubbCLGNxjAn2GU66MOUbwk8DgrxzjVA7MV9xTvy/20p jU6BOD+SodcfBOclxaQuhkncgv2qsPNWhRZgKFmZHPknY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=eYMxNW9osEiBfIjF9+VziXuXoneVgthmjolJwq1IFtQWQgSAh2XgZIPfMYlf8/ qXwJ5g/x7Aet0TrLpyvXotOMuAE4Z/wEqSdm1C5a5P6TsNGfyfhqKKYsbEzF802p cTnkPexXNlyWZxU+N0tBr9ml/Czf5uqpdLt95dSx+wjpI=; Received: (qmail 30134 invoked by alias); 27 Feb 2013 15:08:22 -0000 Received: (qmail 30122 invoked by uid 22791); 27 Feb 2013 15:08:21 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI 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, 27 Feb 2013 15:08:11 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 460F1A41E0; Wed, 27 Feb 2013 16:08:10 +0100 (CET) Date: Wed, 27 Feb 2013 16:08:09 +0100 From: Martin Jambor To: GCC Patches Cc: Jakub Jelinek Subject: [PATCH] Avoid SRA-created debug binds with uninitialized RHSs Message-ID: <20130227150809.GA11809@virgil.suse> Mail-Followup-To: GCC Patches , Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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, looking at dumps of PR 56294 I have noticed that on one occasion, SRA total scalarization mechanism replaced an uninitialized structure with scalar replacements and these then happened to end up in DEBUG bind statements describing another structure. Such replacements then did not end up in the IL anywhere else (and not at all in -g0). SSA renaming is clever enough to replace them with NULLs later on but if the replacements are never initialized in the function, this can be easily avoided. Bootstrapped and tested on x86_64-linux without any issues. So far I do not know whether it is required to fix PR 56294 but the patch is tiny and simply avoids unnecessary work so I'd like to ask for approval to commit to trunk now. Thanks, Martin 2013-02-26 Martin Jambor * tree-sra.c (load_assign_lhs_subreplacements): Do not put replacements with no initialization to the RHS of debug statements. Index: src/gcc/tree-sra.c =================================================================== --- src.orig/gcc/tree-sra.c +++ src/gcc/tree-sra.c @@ -2870,7 +2870,12 @@ load_assign_lhs_subreplacements (struct lacc->size); if (racc && racc->grp_to_be_replaced) - drhs = get_access_replacement (racc); + { + if (racc->grp_write) + drhs = get_access_replacement (racc); + else + drhs = NULL; + } else if (*refreshed == SRA_UDH_LEFT) drhs = build_debug_ref_for_model (loc, lacc->base, lacc->offset, lacc);