eal/x86: fix build with clang for old AVX
authorZhihong Wang <zhihong.wang@intel.com>
Thu, 4 Feb 2016 02:12:34 +0000 (21:12 -0500)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 4 Feb 2016 21:36:02 +0000 (22:36 +0100)
commitbb62344cb7724165c5f337741e327a81fc96d6df
treec605db6ba0c026097d0224e06bc0558230776b83
parentb86af7b1b57ebe02ebf5298415172d51f1f81e8b
eal/x86: fix build with clang for old AVX

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 moving srcofs initialization out of the condition.
Also dstofss calculation is corrected.

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

Reported-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
lib/librte_eal/common/include/arch/x86/rte_memcpy.h