examples/l3fwd: fix aliasing in port grouping
authorGuduri Prathyusha <gprathyusha@caviumnetworks.com>
Fri, 3 Nov 2017 10:43:51 +0000 (16:13 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 7 Nov 2017 09:04:42 +0000 (09:04 +0000)
commit01ac23460c36927e019473e71b582223ad6b79c5
tree4b93ab5b92152af7ca14aa3b9769ea977688a114
parent3a4475e51d13ec3328b291061c38b7c5643a86ee
examples/l3fwd: fix aliasing in port grouping

With -f-strict-aliasing enabled by default from -O2, gcc > 5.x gives
undefined behavior in port_groupx4 in ARM. 'pn' and 'pnum' are
two different pointers pointing to same chunk of memory and
with -f-strict-aliasing the pointers are assumed to be pointing to
different memory and compiler reorders instructions that depend on
pnum and pn. This breaks port grouping algorithm.

This patch eliminates the above problem by introducing a compiler
barrier between the instructions that depend on pnum, pn and lp.

Fixes: 569b290cdb36 ("examples/l3fwd: add NEON implementation")
Cc: stable@dpdk.org
Signed-off-by: Guduri Prathyusha <gprathyusha@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Jianbo Liu <jianbo.liu@arm.com>
examples/l3fwd/l3fwd_neon.h