[dpdk-dev,v2] DPDK does not build on gcc 4.4, as it complains due to strict-aliasing rules in virtual_pmd and link_bonding_mode4 tests, with no errors in next gcc versions:

Message ID 1427713576-31094-1-git-send-email-pablo.de.lara.guarch@intel.com (mailing list archive)
State Rejected, archived
Headers

Commit Message

De Lara Guarch, Pablo March 30, 2015, 11:06 a.m. UTC
  CC virtual_pmd.o
CC test_link_bonding_mode4.o
cc1: warnings being treated as errors
/root/dpdk/app/test/test_link_bonding_mode4.c: In function ‘test_mode4_expired’:
/root/dpdk/x86_64-native-linuxapp-gcc/include/rte_ring.h:645: error: dereferencing pointer ‘pkt.409’ does break strict-aliasing rules
/root/dpdk/x86_64-native-linuxapp-gcc/include/rte_ring.h:729: error: dereferencing pointer ‘pkt.409’ does break strict-aliasing rules
...
cc1: warnings being treated as errors
/root/dpdk/app/test/virtual_pmd.c: In function ‘virtual_ethdev_stats_reset’:
/root/dpdk/x86_64-native-linuxapp-gcc/include/rte_ring.h:645: error: dereferencing pointer ‘pkt.338’ does break strict-aliasing rules
/root/dpdk/x86_64-native-linuxapp-gcc/include/rte_ring.h:729: error: dereferencing pointer ‘pkt.338’ does break strict-aliasing rules

This patch fixes the compilation by disabling
these warnings.

Changes in v2:

Added missing gcc version check (checking if gcc 4.4 is present)

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test/Makefile |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
  

Comments

Thomas Monjalon March 30, 2015, 8:47 p.m. UTC | #1
2015-03-30 12:06, Pablo de Lara:
> CC virtual_pmd.o
> CC test_link_bonding_mode4.o
> cc1: warnings being treated as errors
> /root/dpdk/app/test/test_link_bonding_mode4.c: In function ‘test_mode4_expired’:
> /root/dpdk/x86_64-native-linuxapp-gcc/include/rte_ring.h:645: error: dereferencing pointer ‘pkt.409’ does break strict-aliasing rules
> /root/dpdk/x86_64-native-linuxapp-gcc/include/rte_ring.h:729: error: dereferencing pointer ‘pkt.409’ does break strict-aliasing rules
> ...
> cc1: warnings being treated as errors
> /root/dpdk/app/test/virtual_pmd.c: In function ‘virtual_ethdev_stats_reset’:
> /root/dpdk/x86_64-native-linuxapp-gcc/include/rte_ring.h:645: error: dereferencing pointer ‘pkt.338’ does break strict-aliasing rules
> /root/dpdk/x86_64-native-linuxapp-gcc/include/rte_ring.h:729: error: dereferencing pointer ‘pkt.338’ does break strict-aliasing rules
> 
> This patch fixes the compilation by disabling
> these warnings.
> 
> Changes in v2:
> 
> Added missing gcc version check (checking if gcc 4.4 is present)
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Pawel's proposal was chosen because it doesn't require handling special
compiler version.
  

Patch

diff --git a/app/test/Makefile b/app/test/Makefile
index 4aca77c..9639a71 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -158,6 +158,15 @@  CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
 endif
 endif
 
+# Disable warnings of no-strict-aliasing in virtual_pmd
+# and test_link_bonding_mode4 tests
+ifeq ($(CC), gcc)
+ifeq ($(shell test $(GCC_VERSION) -eq 44 && echo 1), 1)
+CFLAGS_virtual_pmd.o += -Wno-strict-aliasing
+CFLAGS_test_link_bonding_mode4.o += -Wno-strict-aliasing
+endif
+endif
+
 # this application needs libraries first
 DEPDIRS-y += lib