From 3ac932e90b23402b3b18952123fbed97d8d50920 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 17 Jun 2022 17:20:26 +0200 Subject: optimize: do not merge rules with set reference in rhs Otherwise set reference ends up included in an anonymous set, as an element, which is not supported. Signed-off-by: Pablo Neira Ayuso --- src/optimize.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/optimize.c b/src/optimize.c index a2a4e587..543d3ca5 100644 --- a/src/optimize.c +++ b/src/optimize.c @@ -105,6 +105,12 @@ static bool stmt_expr_supported(const struct expr *expr) return false; } +static bool expr_symbol_set(const struct expr *expr) +{ + return expr->right->etype == EXPR_SYMBOL && + expr->right->symtype == SYMBOL_SET; +} + static bool __stmt_type_eq(const struct stmt *stmt_a, const struct stmt *stmt_b, bool fully_compare) { @@ -122,6 +128,10 @@ static bool __stmt_type_eq(const struct stmt *stmt_a, const struct stmt *stmt_b, if (!stmt_expr_supported(expr_a) || !stmt_expr_supported(expr_b)) return false; + + if (expr_symbol_set(expr_a) || + expr_symbol_set(expr_b)) + return false; } return __expr_cmp(expr_a->left, expr_b->left); -- cgit v1.2.3