diff options
| author | Stefan Monnier | 2023-09-27 13:29:50 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2023-09-27 13:29:50 -0400 |
| commit | bc52fdd1d153b36a9da74d7aa7f1e6150ff6b2eb (patch) | |
| tree | a302e300d15378c840b9eab4f49861c375dd52f7 /src | |
| parent | 9a67540e51edca00b17de639af18989f9ecc9be9 (diff) | |
| download | emacs-bc52fdd1d153b36a9da74d7aa7f1e6150ff6b2eb.tar.gz emacs-bc52fdd1d153b36a9da74d7aa7f1e6150ff6b2eb.zip | |
* src/regex-emacs.c (analyze_first): Fix incorrect optimization
The optimization was incorrect in a particular corner case.
In this fix I just disable it conservatively for more cases because
it's not obvious how to fix it while preserving the "good" cases.
We may find a better fix by using an approach like the one
in `mutually_exhaustive_aux`, but for now this is good enough,
especially since \{..\} repetitions are not used very frequently.
* test/src/regex-resources/PTESTS: New test.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regex-emacs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 338323cf79e..ae82dd63917 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c | |||
| @@ -3086,8 +3086,10 @@ analyze_first (re_char *p, re_char *pend, char *fastmap, bool multibyte) | |||
| 3086 | /* We only care about one iteration of the loop, so we don't | 3086 | /* We only care about one iteration of the loop, so we don't |
| 3087 | need to consider the case where this behaves like an | 3087 | need to consider the case where this behaves like an |
| 3088 | on_failure_jump. */ | 3088 | on_failure_jump. */ |
| 3089 | continue; | 3089 | /* FIXME: Sadly, the above is not true when the loop's body |
| 3090 | 3090 | can match the empty string :-( */ | |
| 3091 | /* continue; */ | ||
| 3092 | return -1; | ||
| 3091 | 3093 | ||
| 3092 | case set_number_at: | 3094 | case set_number_at: |
| 3093 | p += 4; | 3095 | p += 4; |