[08/12] net/qede/base: fix build with GCC 12

Message ID 20220518101657.1230416-9-david.marchand@redhat.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series Fix compilation with gcc 12 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand May 18, 2022, 10:16 a.m. UTC
  GCC raises the following warning:

In function ‘_mm256_storeu_si256’,
    inlined from ‘rte_mov32’ at
        ../lib/eal/x86/include/rte_memcpy.h:320:2,
    inlined from ‘rte_mov128’ at
        ../lib/eal/x86/include/rte_memcpy.h:342:2,
    inlined from ‘rte_memcpy_generic’ at
        ../lib/eal/x86/include/rte_memcpy.h:438:4,
    inlined from ‘rte_memcpy’ at
        ../lib/eal/x86/include/rte_memcpy.h:882:10,
    inlined from ‘__ecore_mcp_cmd_and_union’ at
        ../drivers/net/qede/base/ecore_mcp.c:541:3,
    inlined from ‘_ecore_mcp_cmd_and_union’ at
        ../drivers/net/qede/base/ecore_mcp.c:638:2,
    inlined from ‘ecore_mcp_cmd_and_union’ at
        ../drivers/net/qede/base/ecore_mcp.c:742:9:
/usr/lib/gcc/x86_64-redhat-linux/12/include/avxintrin.h:935:8: error:
        array subscript 1 is outside array bounds of
        ‘union drv_union_data[1]’ [-Werror=array-bounds]
  935 |   *__P = __A;
      |   ~~~~~^~~~~
../drivers/net/qede/base/ecore_mcp.c: In function
        ‘ecore_mcp_cmd_and_union’:
../drivers/net/qede/base/ecore_mcp.c:533:30: note: at offset 32 into
        object ‘union_data’ of size 32
  533 |         union drv_union_data union_data;
      |                              ^~~~~~~~~~

Since this code is in the base driver, waive the check until the base
driver is fixed by the relevant people.

Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/qede/base/meson.build | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Stephen Hemminger May 20, 2022, 8:29 p.m. UTC | #1
On Wed, 18 May 2022 12:16:53 +0200
David Marchand <david.marchand@redhat.com> wrote:

> GCC raises the following warning:
> 
> In function ‘_mm256_storeu_si256’,
>     inlined from ‘rte_mov32’ at
>         ../lib/eal/x86/include/rte_memcpy.h:320:2,
>     inlined from ‘rte_mov128’ at
>         ../lib/eal/x86/include/rte_memcpy.h:342:2,
>     inlined from ‘rte_memcpy_generic’ at
>         ../lib/eal/x86/include/rte_memcpy.h:438:4,
>     inlined from ‘rte_memcpy’ at
>         ../lib/eal/x86/include/rte_memcpy.h:882:10,
>     inlined from ‘__ecore_mcp_cmd_and_union’ at
>         ../drivers/net/qede/base/ecore_mcp.c:541:3,
>     inlined from ‘_ecore_mcp_cmd_and_union’ at
>         ../drivers/net/qede/base/ecore_mcp.c:638:2,
>     inlined from ‘ecore_mcp_cmd_and_union’ at
>         ../drivers/net/qede/base/ecore_mcp.c:742:9:
> /usr/lib/gcc/x86_64-redhat-linux/12/include/avxintrin.h:935:8: error:
>         array subscript 1 is outside array bounds of
>         ‘union drv_union_data[1]’ [-Werror=array-bounds]
>   935 |   *__P = __A;
>       |   ~~~~~^~~~~
> ../drivers/net/qede/base/ecore_mcp.c: In function
>         ‘ecore_mcp_cmd_and_union’:
> ../drivers/net/qede/base/ecore_mcp.c:533:30: note: at offset 32 into
>         object ‘union_data’ of size 32
>   533 |         union drv_union_data union_data;
>       |                              ^~~~~~~~~~
> 
> Since this code is in the base driver, waive the check until the base
> driver is fixed by the relevant people.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Or mark driver broken with gcc-12 and get the maintainer to fix?
  
Stephen Hemminger June 21, 2022, 11:17 p.m. UTC | #2
On Wed, 18 May 2022 12:16:53 +0200
David Marchand <david.marchand@redhat.com> wrote:

> GCC raises the following warning:
> 
> In function ‘_mm256_storeu_si256’,
>     inlined from ‘rte_mov32’ at
>         ../lib/eal/x86/include/rte_memcpy.h:320:2,
>     inlined from ‘rte_mov128’ at
>         ../lib/eal/x86/include/rte_memcpy.h:342:2,
>     inlined from ‘rte_memcpy_generic’ at
>         ../lib/eal/x86/include/rte_memcpy.h:438:4,
>     inlined from ‘rte_memcpy’ at
>         ../lib/eal/x86/include/rte_memcpy.h:882:10,
>     inlined from ‘__ecore_mcp_cmd_and_union’ at
>         ../drivers/net/qede/base/ecore_mcp.c:541:3,
>     inlined from ‘_ecore_mcp_cmd_and_union’ at
>         ../drivers/net/qede/base/ecore_mcp.c:638:2,
>     inlined from ‘ecore_mcp_cmd_and_union’ at
>         ../drivers/net/qede/base/ecore_mcp.c:742:9:
> /usr/lib/gcc/x86_64-redhat-linux/12/include/avxintrin.h:935:8: error:
>         array subscript 1 is outside array bounds of
>         ‘union drv_union_data[1]’ [-Werror=array-bounds]
>   935 |   *__P = __A;
>       |   ~~~~~^~~~~
> ../drivers/net/qede/base/ecore_mcp.c: In function
>         ‘ecore_mcp_cmd_and_union’:
> ../drivers/net/qede/base/ecore_mcp.c:533:30: note: at offset 32 into
>         object ‘union_data’ of size 32
>   533 |         union drv_union_data union_data;
>       |                              ^~~~~~~~~~
> 
> Since this code is in the base driver, waive the check until the base
> driver is fixed by the relevant people.

Even there are two maintainers, haven't heard a response from them.
It could be a real bug.
  
David Marchand June 22, 2022, 3:42 p.m. UTC | #3
On Wed, Jun 22, 2022 at 1:17 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
> > GCC raises the following warning:
> >
> > In function ‘_mm256_storeu_si256’,
> >     inlined from ‘rte_mov32’ at
> >         ../lib/eal/x86/include/rte_memcpy.h:320:2,
> >     inlined from ‘rte_mov128’ at
> >         ../lib/eal/x86/include/rte_memcpy.h:342:2,
> >     inlined from ‘rte_memcpy_generic’ at
> >         ../lib/eal/x86/include/rte_memcpy.h:438:4,
> >     inlined from ‘rte_memcpy’ at
> >         ../lib/eal/x86/include/rte_memcpy.h:882:10,
> >     inlined from ‘__ecore_mcp_cmd_and_union’ at
> >         ../drivers/net/qede/base/ecore_mcp.c:541:3,
> >     inlined from ‘_ecore_mcp_cmd_and_union’ at
> >         ../drivers/net/qede/base/ecore_mcp.c:638:2,
> >     inlined from ‘ecore_mcp_cmd_and_union’ at
> >         ../drivers/net/qede/base/ecore_mcp.c:742:9:
> > /usr/lib/gcc/x86_64-redhat-linux/12/include/avxintrin.h:935:8: error:
> >         array subscript 1 is outside array bounds of
> >         ‘union drv_union_data[1]’ [-Werror=array-bounds]
> >   935 |   *__P = __A;
> >       |   ~~~~~^~~~~
> > ../drivers/net/qede/base/ecore_mcp.c: In function
> >         ‘ecore_mcp_cmd_and_union’:
> > ../drivers/net/qede/base/ecore_mcp.c:533:30: note: at offset 32 into
> >         object ‘union_data’ of size 32
> >   533 |         union drv_union_data union_data;
> >       |                              ^~~~~~~~~~
> >
> > Since this code is in the base driver, waive the check until the base
> > driver is fixed by the relevant people.
>
> Even there are two maintainers, haven't heard a response from them.
> It could be a real bug.

Maintainers were pinged privately but I see no progress.
If I don't get a reply from them by tomorrow morning (GMT+2), I will
merge your RFC patch as it seems the best fix atm.

https://patchwork.dpdk.org/project/dpdk/patch/20220607171746.461772-3-stephen@networkplumber.org/
  

Patch

diff --git a/drivers/net/qede/base/meson.build b/drivers/net/qede/base/meson.build
index 4ad177b478..c7b19be20a 100644
--- a/drivers/net/qede/base/meson.build
+++ b/drivers/net/qede/base/meson.build
@@ -44,6 +44,11 @@  error_cflags = [
         '-Wno-sometimes-uninitialized',
         '-Wno-pointer-bool-conversion',
 ]
+# FIXME
+if (toolchain == 'gcc' and cc.version().version_compare('>=12.0.0'))
+    error_cflags += ['-Wno-array-bounds']
+endif
+
 c_args = cflags
 foreach flag: error_cflags
         if cc.has_argument(flag)