DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net: fix build with gcc 4.4.7 and strict aliasing
@ 2015-11-24 15:12 Daniel Mrzyglod
  2015-11-24 15:47 ` Mrzyglod, DanielX T
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Daniel Mrzyglod @ 2015-11-24 15:12 UTC (permalink / raw)
  To: dev

This is fix for GCC 4.4.7.
flag "-fstrict-aliasing" is default for optimalisation above -O0.

Fixes: 2b039d5f20a3 ("net: fix build with gcc 4.4.7 and strict aliasing")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 lib/librte_net/rte_ip.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 71c519a..5b7554a 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -169,7 +169,8 @@ __rte_raw_cksum(const void *buf, size_t len, uint32_t sum)
 {
 	/* workaround gcc strict-aliasing warning */
 	uintptr_t ptr = (uintptr_t)buf;
-	const uint16_t *u16 = (const uint16_t *)ptr;
+	typedef uint16_t __attribute__((__may_alias__)) u16_p;
+	const u16_p *u16 = (const u16_p *)ptr;
 
 	while (len >= (sizeof(*u16) * 4)) {
 		sum += u16[0];
-- 
2.5.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-11-25 20:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 15:12 [dpdk-dev] [PATCH] net: fix build with gcc 4.4.7 and strict aliasing Daniel Mrzyglod
2015-11-24 15:47 ` Mrzyglod, DanielX T
2015-11-24 15:49   ` Bruce Richardson
2015-11-24 16:31 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2015-11-24 16:31   ` Daniel Mrzyglod
2015-11-24 17:58     ` Ananyev, Konstantin
2015-11-25 17:06       ` Mrzyglod, DanielX T
2015-11-25 17:13         ` Ananyev, Konstantin
2015-11-24 22:42   ` Stephen Hemminger
2015-11-25 18:00 ` [dpdk-dev] [PATCH] " Ananyev, Konstantin
2015-11-25 20:58   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).