From 67889d11306a6e531be8d2fe53bc216172b90f5d Mon Sep 17 00:00:00 2001 From: David Christensen Date: Mon, 4 May 2020 14:03:47 -0700 Subject: [PATCH] eal/ppc: fix build with gcc 9.3 Building DPDK on Ubuntu 20.04 with GCC 9.3.0 results in a "subscript is outside array bounds" message in rte_memcpy function. The build error is caused by an interaction between __builtin_constant_p and "-Werror=array-bounds" as described in this bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90387 Modify the code to disable the array-bounds check for GCC versions 9.0 to 9.3. Cc: stable@dpdk.org Signed-off-by: David Christensen --- lib/librte_eal/ppc/include/rte_memcpy.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/librte_eal/ppc/include/rte_memcpy.h b/lib/librte_eal/ppc/include/rte_memcpy.h index d685b7b15b..c2a1f356d5 100644 --- a/lib/librte_eal/ppc/include/rte_memcpy.h +++ b/lib/librte_eal/ppc/include/rte_memcpy.h @@ -10,6 +10,7 @@ #include #include "rte_altivec.h" +#include "rte_common.h" #ifdef __cplusplus extern "C" { @@ -17,6 +18,11 @@ extern "C" { #include "generic/rte_memcpy.h" +#if (GCC_VERSION >= 90000 && GCC_VERSION < 90400) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif + static inline void rte_mov16(uint8_t *dst, const uint8_t *src) { @@ -192,6 +198,10 @@ rte_memcpy_func(void *dst, const void *src, size_t n) return ret; } +#if (GCC_VERSION >= 90000 && GCC_VERSION < 90400) +#pragma GCC diagnostic pop +#endif + #ifdef __cplusplus } #endif -- 2.20.1