examples/l3fwd: fix crash with gcc 5
authorTomasz Kulasek <tomaszx.kulasek@intel.com>
Mon, 4 Apr 2016 14:45:23 +0000 (16:45 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 6 Apr 2016 09:35:33 +0000 (11:35 +0200)
commitaf1694d94bf14371e4199d22464f214d4112b67a
tree3fdb7c7c56e35ddae99b3c9ef59f15b3e5e58393
parentbdf54f7a519c196784ea0c0d216da0e9dff272a7
examples/l3fwd: fix crash with gcc 5

It seems that with gcc >5.x and -O2/-O3 optimization breaks packet
grouping algorithm.

When last packet pointer "lp" and "pnum->u64" buffer points the same
memory buffer, high optimization can cause unpredictable results.
It seems that assignment of precalculated group sizes may interfere
with initialization of new group size when lp points value inside
current group and didn't should be changed.

With gcc >5.x and optimization we cannot be sure which assignment will
be done first, so the group size can be counted incorrectly.

This patch eliminates intersection of assignment of initial group size
(lp[0] = 1) and precalculated group sizes when gptbl[v].idx < 4.

Fixes: 94c54b4158d5 ("examples/l3fwd: rework exact-match")

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
examples/l3fwd/l3fwd_sse.h