From 6faeff915e961443d66b10caf9af4cbed6fb8451 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 1 Nov 2020 19:58:47 +0200 Subject: Fix a bug in dfa.c, add test case. --- support/ChangeLog | 4 ++++ support/dfa.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'support') diff --git a/support/ChangeLog b/support/ChangeLog index b81b0e71..edef437e 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,7 @@ +2020-11-01 Arnold D. Robbins + + * dfa.c: Synced from GNULIB. + 2020-10-15 Arnold D. Robbins * random.c: Move code to using prototypes. diff --git a/support/dfa.c b/support/dfa.c index 8aef2f37..df32dd90 100644 --- a/support/dfa.c +++ b/support/dfa.c @@ -2437,7 +2437,7 @@ merge_nfa_state (struct dfa *d, idx_t tindex, char *flags, continue; } - if (!(flags[sindex] & (OPT_LPAREN | OPT_RPAREN))) + if (sindex != tindex && !(flags[sindex] & (OPT_LPAREN | OPT_RPAREN))) { idx_t j; @@ -2445,6 +2445,9 @@ merge_nfa_state (struct dfa *d, idx_t tindex, char *flags, { idx_t dindex = follows[tindex].elems[j].index; + if (dindex == tindex) + continue; + if (follows[tindex].elems[j].constraint != iconstraint) continue; -- cgit v1.2.3