GCC 4.9.0 triggers a warning (array-bounds) while compiling test-classifier.c
This commit introduces an assertion that suppresses the warning.

Signed-off-by: Daniele Di Proietto <ddiproie...@vmware.com>
---
While I feel that this is a GCC problem, this simple (IMHO harmful) assertion
fixes the issue.
What do you guys think?
---
 tests/test-classifier.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/test-classifier.c b/tests/test-classifier.c
index 42c18bc..62f192f 100644
--- a/tests/test-classifier.c
+++ b/tests/test-classifier.c
@@ -432,6 +432,9 @@ compare_classifiers(struct classifier *cls, struct tcls 
*tcls)
         flow.nw_proto = nw_proto_values[get_value(&x, N_NW_PROTO_VALUES)];
         flow.nw_tos = nw_dscp_values[get_value(&x, N_NW_DSCP_VALUES)];
 
+        /* This assertion is here to suppress a GCC 4.9 array-bounds warning */
+        ovs_assert(cls->cls->n_tries <= CLS_MAX_TRIES);
+
         cr0 = classifier_lookup(cls, &flow, &wc);
         cr1 = tcls_lookup(tcls, &flow);
         assert((cr0 == NULL) == (cr1 == NULL));
-- 
2.0.0

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to