From patchwork Tue Dec 22 10:04:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 559953 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 59449140BB7 for ; Tue, 22 Dec 2015 21:04:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=nhVydYpx; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=Of1kv4WocLVYvqQmFBJYaN9OTW6nbDgPq8EFCIdofWW39IBGCzBBX ImLwYKynBh92EmYym+sEQVFBqcc86N6L21YEglPE3uPALFO2xVnE599Mya6fAUuo goiztRFVg9EYXRjeg+ZG2/CkK+MMDu7JsDGPvuW8qgurATN/Rq7LPE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=PshfVOaiAmhLtrno3ac0bbX5j+s=; b=nhVydYpx3D3G63t35BZt uhULP5LG0ezzTznVwfLSHQAhL2fPu8IlvmZM9wTkA2bGxOOvY1QROUw7sOwK8DJd ORsnH+WPlQNZIAqa06D8kVeqm8Qi6extm50qsw3B/IM5gkdQXNfxYmlTxTcYmy33 fudqDlVRnow/mXQ30wvW6S0= Received: (qmail 92295 invoked by alias); 22 Dec 2015 10:04:36 -0000 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 Received: (qmail 92280 invoked by uid 89); 22 Dec 2015 10:04:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1212, examined, 2015-12-22 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 22 Dec 2015 10:04:35 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id D33013B718 for ; Tue, 22 Dec 2015 10:04:33 +0000 (UTC) Received: from littlehelper.redhat.com (vpn1-4-24.ams2.redhat.com [10.36.4.24]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBMA4VSd022701 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 22 Dec 2015 05:04:33 -0500 From: Nick Clifton To: gcc-patches@gcc.gnu.org Subject: RFA: PR 68770: Fix use of uninitialised value in secondary_reload Date: Tue, 22 Dec 2015 10:04:30 +0000 Message-ID: <87vb7qsssx.fsf@redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes Hi Guys, The patch below fixes PR 68770 - a warning from valgrind about an uninitialised value being used in the default_secondary_reload. The problem turns out to the in copy_costs which creates its own secondary reload information structure, but it does not initialise all of the fields. One field in particular - t_icode - is examined by default_secondary_reload, and it was this that was triggering the valgrind warning. Tested with no regressions on a x86_64-pc-linux-gnu and a powerpc64-le-linux-gnu toolchain. OK to apply ? Cheers Nick gcc/ChangeLog 2015-12-22 Nick Clifton PR target/68770 * ira-costs.c (copy_cost): Initialise the t_code field of the sri structure. Index: ira-costs.c =================================================================== --- ira-costs.c (revision 231898) +++ ira-costs.c (working copy) @@ -442,6 +442,9 @@ copy it. */ sri.prev_sri = prev_sri; sri.extra_cost = 0; + /* PR 68770: Secondary reload might examine the t_icode field. */ + sri.t_icode = CODE_FOR_nothing; + secondary_class = targetm.secondary_reload (to_p, x, rclass, mode, &sri); if (secondary_class != NO_REGS)