From patchwork Wed Aug 13 09:49:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 35340 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0536E203C5 for ; Wed, 13 Aug 2014 09:49:59 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id j7sf29233905qaq.1 for ; Wed, 13 Aug 2014 02:49:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=Cx8uWDjvmyy+dYwJNrawoxl5CbXvjI9MCq8tikZRzTs=; b=gU71b6GfHAR9pr22jly9vOLt0awmyLHPZZdFkwpBySEbBjjULsD4hQSi2h3/9jNnZ1 Jod8ks5EDjneNdyqYfMlLUPF2hAS4Gj0Ie19Ee44HoI+KShKRSpSD9mRPVZqi+Y58KBi 85WIjcJ7YvxTKkNUt6Ub1+gyaLEoIsOR6BL79cbsvqerC6ID+EoAMuPBwgNCK6pgM4Bb d6S9WEGoVTvSd2eajJLfA21Zrc9u9b/D8CTwNstJJgZnFK4X5NHX+Y9w5LdIuxHDeL9B 9igGKD6+R6LHoUenN4HMqw89UWMZ0dzI1SzOsedEpSf8g9/yhi6yQqsQHsii2MobR1x/ p33Q== X-Gm-Message-State: ALoCoQl7bcpxixjJCPLeEg706G0dI1fCab6Qkv29BGWcT8LRszfd2AIXcHd82tSH2VqDdddz8Q8C X-Received: by 10.236.124.161 with SMTP id x21mr1913282yhh.48.1407923398858; Wed, 13 Aug 2014 02:49:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.228 with SMTP id d91ls578084qge.41.gmail; Wed, 13 Aug 2014 02:49:58 -0700 (PDT) X-Received: by 10.220.110.77 with SMTP id m13mr2608289vcp.35.1407923398770; Wed, 13 Aug 2014 02:49:58 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id pz7si787824vcb.5.2014.08.13.02.49.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Aug 2014 02:49:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id im17so14711221vcb.31 for ; Wed, 13 Aug 2014 02:49:58 -0700 (PDT) X-Received: by 10.220.105.142 with SMTP id t14mr1452160vco.14.1407923398691; Wed, 13 Aug 2014 02:49:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp316686vcb; Wed, 13 Aug 2014 02:49:58 -0700 (PDT) X-Received: by 10.50.128.46 with SMTP id nl14mr6078476igb.48.1407923397866; Wed, 13 Aug 2014 02:49:57 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id np5si2919386icc.97.2014.08.13.02.49.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 13 Aug 2014 02:49:57 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XHVBl-00070O-Eq; Wed, 13 Aug 2014 09:49:49 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XHVBk-00070I-Mg for edk2-devel@lists.sourceforge.net; Wed, 13 Aug 2014 09:49:48 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=lersek@redhat.com; helo=mx1.redhat.com; Received: from mx1.redhat.com ([209.132.183.28]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1XHVBg-0007db-K4 for edk2-devel@lists.sourceforge.net; Wed, 13 Aug 2014 09:49:48 +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 (8.14.4/8.14.4) with ESMTP id s7D9nZRS027091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Aug 2014 05:49:36 -0400 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7D9nV8k004349; Wed, 13 Aug 2014 05:49:34 -0400 From: Laszlo Ersek To: liming.gao@intel.com, edk2-devel@lists.sourceforge.net, jordan.l.justen@intel.com, michael.d.kinney@intel.com Date: Wed, 13 Aug 2014 11:49:28 +0200 Message-Id: <1407923369-30959-2-git-send-email-lersek@redhat.com> In-Reply-To: <1407923369-30959-1-git-send-email-lersek@redhat.com> References: <1407923369-30959-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -2.2 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1XHVBg-0007db-K4 Subject: [edk2] [PATCH 1/2] MdePkg: BaseOrderedCollectionRedBlackTreeLib: silence invalid gcc warning X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Gcc-4.4 reports the following build failure: BaseOrderedCollectionRedBlackTreeLib.c: In function 'OrderedCollectionInsert': BaseOrderedCollectionRedBlackTreeLib.c:586: error: 'Result' may be used uninitialized in this function This is incorrect. There are two areas of use of Result to consider: - In the very first while loop. The warning is likely not about this code area, because Result is assigned directly before use. - The last use of Result in the function. The build warning / error is incorrect. For Result to be uninitialized at that point, the very first while loop must not have been entered at all (because that loop assigns a value to Result). However, if that loop is never entered, then Parent is still NULL. And Parent==NULL implies that the use of Result is never reached, because we jump to the Done label just before it. Assign an irrelevant value of 0 to Result at the beginning of the function in order to silence the incorrect warning. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- .../BaseOrderedCollectionRedBlackTreeLib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c index fc554b7..9f40b70 100644 --- a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c +++ b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c @@ -589,6 +589,7 @@ OrderedCollectionInsert ( Tmp = Tree->Root; Parent = NULL; + Result = 0; // // First look for a collision, saving the last examined node for the case