From patchwork Wed Aug 14 20:50:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang David Li X-Patchwork-Id: 267201 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id A51532C0162 for ; Thu, 15 Aug 2013 06:50:41 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=iOxVoePmSQtHNjG0J8 bUuyqTPD4KWnJKfjhNqjhO6oQrQZU6akwhBmu8iuxoEvC++tBobFpnfv6zYo3dRP cZ9zzIP2Lp1Wd0XqPc0LitQzZUAIq8GpBcKXsUaOBh978NdIr6R39NWI/sQJubZt 5f3Qo/wLxrtalKvhmdRJ9YNuc= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=NnkkcVD6Tb1tyj3Sv/nxVgNY LXc=; b=GE1Ak/gBSd/IdgwEANSVMFEmv6lVRD+mErtT5veJ+KE0oe/BnJjUbjvV FrGdJCnpFEdk3tplQyMWQMHmoCNoimwqe5PS0Wn7BkTZM7gVEn9Hs1XysQRogn8L 1yFDhij8Ic1ivNy7CUwgohc5KbVg2xk977rKEQgbcigvl0oUons= Received: (qmail 7817 invoked by alias); 14 Aug 2013 20:50:34 -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 7801 invoked by uid 89); 14 Aug 2013 20:50:34 -0000 X-Spam-SWARE-Status: No, score=-5.5 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 Received: from mail-wi0-f179.google.com (HELO mail-wi0-f179.google.com) (209.85.212.179) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 14 Aug 2013 20:50:33 +0000 Received: by mail-wi0-f179.google.com with SMTP id hr7so2460883wib.6 for ; Wed, 14 Aug 2013 13:50:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=+KYfoTfl0PdarCMSULe3mmoaofdckBbTZtP4V+s5fJ0=; b=celYZ3F69ab3WEhxhDgacgCM6q0ACeITgt9NmoDYwmY8UeXLCpO9hRQX6WsV8pj/w0 EWCUaMNdYUuXNE8gT6fP4KHQf8JMUmy6vmYIAkNF8lE9F/F/IkuHtOg3B1OnVniCtum8 PA5ZyrBOUdn4vLo5VRe+LV0CTLQ3zztrdzJ06bGe3tvhUMPvVEMyAwPqW7HdLedaWHOX /7XhZJdZFQmrweT7cGq8XcucwomHqaT3posrk9Uv8hr6lGPIwWzwC4FuNEg/JEOmlHKB 29QVMvnrs0fUj0pBLmC2Gn2aVDhZ+A9QctQx8/0eW5OomAfq7GrpkVnzR0CYDU3fMs7z FYMg== X-Gm-Message-State: ALoCoQnpXRFGkXtVER/P3Drw5z+cwZ9XmlkVkZFH1jy84iSMbiICspeVVIwThQ/JXynrZ/750ZdrcvUXQI8mXRu07ExRMOt+nD4/wKX9s3zXDu3R5HhaSNaodvI3X1LEMLt3UuYV2oHdkaJwWyccU/akkj9bGItS+i9ZZX51td1yG9VWbE9ObdPC1q30Z6qDufqgEG0L9gsCbEH5LlpOoPVXXcBi7cpWsw== MIME-Version: 1.0 X-Received: by 10.180.11.200 with SMTP id s8mr3079489wib.10.1376513431530; Wed, 14 Aug 2013 13:50:31 -0700 (PDT) Received: by 10.180.212.81 with HTTP; Wed, 14 Aug 2013 13:50:31 -0700 (PDT) In-Reply-To: <20130814182346.GT1814@tucnak.redhat.com> References: <20130814181755.GV17022@redhat.com> <20130814182346.GT1814@tucnak.redhat.com> Date: Wed, 14 Aug 2013 13:50:31 -0700 Message-ID: Subject: Re: Fix potential uninitialized variable error From: Xinliang David Li To: Jakub Jelinek Cc: Marek Polacek , GCC Patches Here is the clean up patch. Ok for trunk? thanks, David On Wed, Aug 14, 2013 at 11:23 AM, Jakub Jelinek wrote: > On Wed, Aug 14, 2013 at 08:17:55PM +0200, Marek Polacek wrote: >> On Wed, Aug 14, 2013 at 11:12:27AM -0700, Xinliang David Li wrote: >> > Index: ChangeLog >> > =================================================================== >> > --- ChangeLog (revision 201732) >> > +++ ChangeLog (working copy) >> > @@ -1,4 +1,8 @@ >> > 2013-08-14 Xinliang David Li >> > + * config/i386/i386.c (ix86_option_override_internal): >> > + Fix potential unitialized variable error. >> >> The CL entry is missing a blank line. > > Also, the patch is not obvious. The uninitialization is not potential, it > is unconditional for n == 0, but more importantly, nothing ever uses > input_ranges[...].min field, so it is clearly a write only field and thus > IMHO should be dropped altogether together with the mins variable. > > Jakub Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 201735) +++ config/i386/i386.c (working copy) @@ -2792,7 +2792,6 @@ static const char *stringop_alg_names[] struct stringop_size_range { - int min; int max; stringop_alg alg; bool noalign; @@ -2815,7 +2814,7 @@ ix86_parse_stringop_strategy_string (cha do { - int mins = 0, maxs; + int maxs; stringop_alg alg; char alg_name[128]; char align[16]; @@ -2831,7 +2830,7 @@ ix86_parse_stringop_strategy_string (cha return; } - if (n > 0 && (maxs < (mins = input_ranges[n - 1].max + 1) && maxs != -1)) + if (n > 0 && (maxs < (input_ranges[n - 1].max + 1) && maxs != -1)) { error ("size ranges of option %s should be increasing", is_memset ? "-mmemset_strategy=" : "-mmemcpy_strategy="); @@ -2855,7 +2854,6 @@ ix86_parse_stringop_strategy_string (cha return; } - input_ranges[n].min = mins; input_ranges[n].max = maxs; input_ranges[n].alg = alg; if (!strcmp (align, "align")) Index: ChangeLog =================================================================== --- ChangeLog (revision 201735) +++ ChangeLog (working copy) @@ -1,6 +1,12 @@ 2013-08-14 Xinliang David Li + + * config/i386/i386.c (ix86_option_override_internal): + Remove unused variable and field. + +2013-08-14 Xinliang David Li + * config/i386/i386.c (ix86_option_override_internal): - Fix potential unitialized variable error. + Fix uninitialized variable error. 2013-08-14 Xinliang David Li