[dpdk-dev] [PATCH v2] mk: report address of packed member as warning

Burakov, Anatoly anatoly.burakov at intel.com
Thu May 2 17:53:50 CEST 2019


On 02-May-19 3:13 PM, Reshma Pattan wrote:
> gcc 9 on Fedora 30 gives an error
> "taking address of packed member may result in an
> unaligned pointer value" for -Waddress-of-packed-member.
> 
> Report it as warning instead of error to fix the build.
> 
> Snippet of build before fix
> ...lib/librte_eal/linux/eal/eal_memalloc.c: In function ‘alloc_seg_walk’:
> ...lib/librte_eal/linux/eal/eal_memalloc.c:768:12: error: taking address
> of packed member of ‘struct rte_mem_config’ may result in an unaligned
> pointer value [-Werror=address-of-packed-member]
>    768 |  cur_msl = &mcfg->memsegs[msl_idx];
>        |            ^~~~~~~~~~~~~~~~~~~~~~~
> 
> Snippet of build after fix
> ..lib/librte_eal/linux/eal/eal_memory.c: In function ‘remap_segment’:
> ..lib/librte_eal/linux/eal/eal_memory.c:685:9: warning: taking address
> of packed member of ‘struct rte_mem_config’ may result in an unaligned
> pointer value [-Waddress-of-packed-member]
>    685 |   msl = &mcfg->memsegs[msl_idx];
> 

Fixing these would require an ABI break, because these are exposed 
externally. Should we submit a deprecation notice for EAL?


-- 
Thanks,
Anatoly


More information about the dev mailing list