[dpdk-dev] [PATCH 0/5] fix compilation issues seen with clang-3.5
Bruce Richardson
bruce.richardson at intel.com
Wed Dec 17 15:24:38 CET 2014
On Wed, Dec 17, 2014 at 02:08:27PM +0000, Bruce Richardson wrote:
> On Wed, Dec 17, 2014 at 01:55:20PM +0100, Olivier Matz wrote:
> > This series are compilation fixes seen with clang-3.5 on linux.
> >
> > Olivier Matz (5):
> > test-devargs: fix misplaced braces in strncmp call
> > examples/l3fwd: fix compilation with clang 3.5
> > examples/netmap: fix overflow in ioctl operation
> > examples/vm_power_manager: move -lvirt in LDLIBS
> > examples/vm_power_manager: fix initialization of cmdline token
> >
> > app/test/test_devargs.c | 2 +-
> > examples/l3fwd/main.c | 4 +++-
> > examples/netmap_compat/lib/compat_netmap.c | 2 +-
> > examples/netmap_compat/lib/compat_netmap.h | 2 +-
> > examples/vm_power_manager/Makefile | 4 +++-
> > examples/vm_power_manager/vm_power_cli.c | 2 +-
> > 6 files changed, 10 insertions(+), 6 deletions(-)
> >
> > --
> > 2.1.3
> >
>
> Interesting. I've just upgraded to Fedora 21, and I'm getting a lot of other,
> different errors on compilation using its version of clang (3.4.2). Patches soon
> to follow, but I'm surprised that they don't show up in clang 3.5. Perhaps they
> are just compiler bugs in the Fedora version.
> Examples of the errors are shown below.
>
> /Bruce
>
This is the latest compile problem I see on Fedora 21 with clang. Anyone care
to suggest a suitable fix?
CC rte_eth_bond_args.o
/home/bruce/dpdk.org/lib/librte_pmd_bond/rte_eth_bond_args.c:237:1201: fatal error: array index 3 is past the end of the array (which contains 3 elements) [-Warray-bounds]
if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (("l2")) && __builtin_constant_p (value) && (__s1_len = strlen (("l2")), __s2_len = strlen (value), (!((size_t)(const void *)((("l2")) + 1) - (size_t)(const void *)(("l2")) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((value) + 1) - (size_t)(const void *)(value) == 1) || __s2_len >= 4)) ? __builtin_strcmp (("l2"), value) : (__builtin_constant_p (("l2")) && ((size_t)(const void *)((("l2")) + 1) - (size_t)(const void *)(("l2")) == 1) && (__s1_len = strlen (("l2")), __s1_len < 4) ? (__builtin_constant_p (value) && ((size_t)(const void *)((value) + 1) - (size_t)(const void *)(value) == 1) ? __builtin_strcmp (("l2"), value) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (value); int __result = (((const unsigned char *) (const char *) (("l2")))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (("l2")))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (("l2")))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (("l2")))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (value) && ((size_t)(const void *)((value) + 1) - (size_t)(const void *)(value) == 1) && (__s2_len = strlen (value), __s2_len < 4) ? (__builtin_constant_p (("l2")) && ((size_t)(const void *)((("l2")) + 1) - (size_t)(const void *)(("l2")) == 1) ? __builtin_strcmp (("l2"), value) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (("l2")); int __result = (((const unsigned char *) (const char *) (value))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (value))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (value))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (value))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (("l2"), value)))); }) == 0)
The offending line is the seemingly innoculous:
237 if (strcmp(PMD_BOND_XMIT_POLICY_LAYER2_KVARG, value) == 0)
where the first parameter is the constant value "12".
Any thoughts in the community?
/Bruce
More information about the dev
mailing list