quoted
app/test-pmd/csumonly.c: In function ‘get_psd_sum’:
build/include/rte_ip.h:161: error: dereferencing pointer ‘u16’
does break strict-aliasing rules
build/include/rte_ip.h:157: note: initialized from here
...
The root cause is that, compile enable strict aliasing by default,
while in function rte_raw_cksum() try to convert 'const char *'
to 'const uint16_t *'.
This patch is one workaround fix.
Signed-off-by: Michael Qiu <redacted>
---
v3 --> v2:
use uintptr_t instead of unsigned long to
save pointer.
v2 --> v1:
Workaround solution instead of shut off the
gcc params.
This workaround is to solve the compile issue of GCC strict-aliasing(Two
different type pointers should not be point to the same memory address).
For GCC 4.4.7 it will definitely occurs if flags "-fstrict-aliasing"
and "-Wall" used.
Acked-by: Thomas Monjalon <redacted>>
Applied with a comment in the code.
Thanks
--
Thomas
Thomas, Michael,
Wouldn't it cause unaligned memory access (new changes as well as the
previous code)? Wondering if get_unaligned/put_unaligned macros similar to
the ones used in kernel be ported to user-space?
Thanks,
Ravi
On Wed, Dec 10, 2014 at 4:54 PM, Thomas Monjalon [off-list ref]
wrote:
quoted
quoted
app/test-pmd/csumonly.c: In function 'get_psd_sum':
build/include/rte_ip.h:161: error: dereferencing pointer 'u16'
does break strict-aliasing rules
build/include/rte_ip.h:157: note: initialized from here
...
The root cause is that, compile enable strict aliasing by default,
while in function rte_raw_cksum() try to convert 'const char *'
to 'const uint16_t *'.
This patch is one workaround fix.
Signed-off-by: Michael Qiu <redacted>
---
v3 --> v2:
use uintptr_t instead of unsigned long to
save pointer.
v2 --> v1:
Workaround solution instead of shut off the
gcc params.
This workaround is to solve the compile issue of GCC strict-aliasing(Two
different type pointers should not be point to the same memory address).
For GCC 4.4.7 it will definitely occurs if flags "-fstrict-aliasing"
and "-Wall" used.
Acked-by: Thomas Monjalon <redacted>>
Applied with a comment in the code.
Thanks
--
Thomas
On 2014/12/12 1:51, r k wrote:
Thomas, Michael,
Wouldn't it cause unaligned memory access (new changes as well as the previous code)? Wondering if get_unaligned/put_unaligned macros similar to the ones used in kernel be ported to user-space?
I think it will not, as all buf point to are struct udp_hdr/struct tcp_hdr/struct ipv6_psd_header/struct ipv4_psd_header, they are all aligned with uint16_t.
Thanks
Michael
Thanks,
Ravi
On Wed, Dec 10, 2014 at 4:54 PM, Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org<mailto:thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>> wrote:
quoted
app/test-pmd/csumonly.c: In function ‘get_psd_sum’:
build/include/rte_ip.h:161: error: dereferencing pointer ‘u16’
does break strict-aliasing rules
build/include/rte_ip.h:157: note: initialized from here
...
The root cause is that, compile enable strict aliasing by default,
while in function rte_raw_cksum() try to convert 'const char *'
to 'const uint16_t *'.
This patch is one workaround fix.
Signed-off-by: Michael Qiu <michael.qiu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org<mailto:michael.qiu@intel.com>>
---
v3 --> v2:
use uintptr_t instead of unsigned long to
save pointer.
v2 --> v1:
Workaround solution instead of shut off the
gcc params.
This workaround is to solve the compile issue of GCC strict-aliasing(Two
different type pointers should not be point to the same memory address).
For GCC 4.4.7 it will definitely occurs if flags "-fstrict-aliasing"
and "-Wall" used.
Acked-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org<mailto:thomas.monjalon@6wind.com>>>
Applied with a comment in the code.
Thanks
--
Thomas