From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45])
 by dpdk.org (Postfix) with ESMTP id 68CB595D9
 for <dev@dpdk.org>; Wed,  3 Feb 2016 19:58:00 +0100 (CET)
Received: by mail-wm0-f45.google.com with SMTP id 128so179725290wmz.1
 for <dev@dpdk.org>; Wed, 03 Feb 2016 10:58:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references;
 bh=k6BnYOA/mDQu10JYKqh4oiLft7tbXjuNebwaEyQlRMU=;
 b=r64jpsszMelDpqQD0kRQnDDgNNVVXoUmdF2fdIj5/9afwp00Vx7Lr/eXjyt9nn1JNs
 CkX2c7Kj8i0vEMaze+V3gm5wL/67hHkeB7aUSqcKvycRZP6Q9tnuCNL6WsgZ815DK9yV
 Uhspnq/D0ZLsDO7RCLJX0oxlrg0tAyX3jUY7VpsAHE9JsllJrCSasJlx1D7V4+qjwPvT
 orgOmGOFSu8LNpq67wFTqAbPSvWaY/jsovkUjKdFZT2AK//KtAkf5KFJj1f295ZTQLI9
 rplq1+esantVymZrHCEvk2wnUOFYC3E6QBZj+N73gJK8qqplby4Mkb8o0qqnNZ4pEYkc
 AfKg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references;
 bh=k6BnYOA/mDQu10JYKqh4oiLft7tbXjuNebwaEyQlRMU=;
 b=ERT5iBCjV+KxoBpsuAin1eGpfm7lEk4xH9R5UBW6f3+PODJGS5DVw4JYJ+79nreguk
 Ltil3sgEr4lNint1XPT5EwTVNnKF/zIRaM5YsV3kl6Bj294ShMJ1UqsB2Sd5QnQPVDd5
 yFUMjiMxDWaqxv9xoC4M+wbBYtPadRSp2By6uu+WzEN2IpNLvB8b+XMoIElQxnCzHhL3
 Zlhp2hLwTIQZYP3izCySBy8OilC5kKsW4kHru4LSHaIIyQSOF4abvYjGT/Fpi4yt8st7
 lcrsnlZQUvFMVnS4n9l5qjVlhDpBeHbMYQ+9szOIcdMxh+nailYErJWjcJpLeeJKkKB3
 XlNQ==
X-Gm-Message-State: AG10YOSyJ0dzUhjpb4/loepAsm+a6Nk4xJq9fWLcarsCIxqdoZ8G0RZ5UxkjY7QPEQSbPQnZ
X-Received: by 10.194.87.201 with SMTP id ba9mr3640635wjb.128.1454525880229;
 Wed, 03 Feb 2016 10:58:00 -0800 (PST)
Received: from localhost.localdomain (136-92-190-109.dsl.ovh.fr.
 [109.190.92.136])
 by smtp.gmail.com with ESMTPSA id qs1sm7823424wjc.2.2016.02.03.10.57.58
 (version=TLSv1/SSLv3 cipher=OTHER);
 Wed, 03 Feb 2016 10:57:59 -0800 (PST)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Date: Wed,  3 Feb 2016 19:56:37 +0100
Message-Id: <1454525799-25552-2-git-send-email-thomas.monjalon@6wind.com>
X-Mailer: git-send-email 2.7.0
In-Reply-To: <1454525799-25552-1-git-send-email-thomas.monjalon@6wind.com>
References: <1454525799-25552-1-git-send-email-thomas.monjalon@6wind.com>
Subject: [dpdk-dev] [PATCH 1/3] eal/x86: fix build with clang for old AVX
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 03 Feb 2016 18:58:00 -0000

When configuring RTE_MACHINE to "default", rte_memcpy implementation
is the default one (old AVX).
In this code, clang raises a warning thanks to -Wsometimes-uninitialized:

rte_memcpy.h:838:6: error:
variable 'srcofs' is used uninitialized whenever 'if' condition is false
        if (dstofss > 0) {
            ^~~~~~~~~~~
rte_memcpy.h:849:6: note: uninitialized use occurs here
        if (srcofs == 0) {
            ^~~~~~

It is fixed by initializing srcofs to 0.

Fixes: 1ae817f9f887 ("eal/x86: tune memcpy for platforms without AVX512")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
index 8e2c53c..5badfbc 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -739,7 +739,7 @@ rte_memcpy(void *dst, const void *src, size_t n)
 	uintptr_t srcu = (uintptr_t)src;
 	void *ret = dst;
 	size_t dstofss;
-	size_t srcofs;
+	size_t srcofs = 0;
 
 	/**
 	 * Copy less than 16 bytes
-- 
2.7.0