You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT keeps a capture returned from an abandoned (*ACCEPT) subroutine attempt #1047
Found while working on #1046. With JIT, a group returned through a capture list ((?&name(N))) can keep the value it had in an attempt of the called group that was later abandoned. Reproducer from @NWilson in #1046:
/^(?:(?&r(2))X|a)(?(2)Y|b)$(?(DEFINE)(?<r>(a)(*ACCEPT)x))/
ab
aY
pcre2test output (main at 9b338eb, CMake Release build, JIT on, macOS arm64):
/^(?:(?&r(2))X|a)(?(2)Y|b)$(?(DEFINE)(?<r>(a)(*ACCEPT)x))/jit
ab
No match
aY
0: aY
1: <unset>
2: a
The first alternative (?&r(2))X fails (no X after the returned a), so the second alternative a matches and group 2 should be unset at the (?(2)…) condition: ab should match and aY should not. With JIT, group 2 keeps a from the abandoned first alternative.
The interpreter on main fails on this pattern with error -44 (that is what #1046 fixes); with #1046 it matches ab and rejects aY.
Activity