Thread (3 messages) flat view 3 messages, 3 authors, 2014-12-12

Re: [PATCH v3] test-pmd: Fix pointer aliasing error

From: Thomas Monjalon <hidden>
Date: 2014-12-11 00:54:21

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help