From 9a3fcd7d06c767246a494738b7893b674f0d079f Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Mon, 17 Feb 2020 11:01:38 +0100
Subject: [PATCH] disable memoization on h_follow()

this makes the computation more wasteful but avoids issue 92. intermediate
results could end up in the memoization table and be treated as final by
later calls to h_follow(). this problem could appear or not depending on the
order of nonterminals (i.e. pointers) in a hashtable.
---
 src/cfgrammar.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/cfgrammar.c b/src/cfgrammar.c
index 1d807123..f9ece036 100644
--- a/src/cfgrammar.c
+++ b/src/cfgrammar.c
@@ -616,6 +616,8 @@ const HStringMap *h_follow(size_t k, HCFGrammar *g, const HCFChoice *x)
   }
   assert(x_found || x == g->start);        // no orphan non-terminals
 
+  h_hashtable_del(g->follow[k], x);
+
   return ret;
 }
 
-- 
GitLab