Debug: SCAN_PARANOIA: protection when expr would notify multiple ENTITY-ies
[tac_plus.git] / cfgeval.c
index c85122a..fcd3a97 100644 (file)
--- a/cfgeval.c
+++ b/cfgeval.c
@@ -1067,8 +1067,15 @@ struct expr *expr;
        report(LOG_DEBUG, "expr_eval_notify_expr: REGISTERED notify " PF_EXPR " when " PF_ENTITY " is known",
                PA_EXPR(expr), PA_ENTITY(entity));
 
-    if (tac_list_node_get_list(&expr->eval_scan.u.entity.notify_expr_node))
+    if (tac_list_node_get_list(&expr->eval_scan.u.entity.notify_expr_node)) {
+#ifdef SCAN_PARANOIA
+       if (&entity->eval_scan.notify_expr_list
+        != tac_list_node_get_list(&expr->eval_scan.u.entity.notify_expr_node))
+           report(LOG_ERR, "Another " PF_ENTITY " already registered in notify node of " PF_EXPR,
+               PA_ENTITY(EXPR_ENTITY_TO_NOTIFYING_ENTITY(expr)), PA_EXPR(expr));
+#endif
        return;
+    }
 
     tac_list_addtail(&entity->eval_scan.notify_expr_list,
            &expr->eval_scan.u.entity.notify_expr_node);