diff options
| author | Nikita Popov <npopov@redhat.com> | 2023-01-16 15:03:35 +0100 |
|---|---|---|
| committer | Nikita Popov <npopov@redhat.com> | 2023-01-17 09:58:10 +0100 |
| commit | bb5e26dad9512e5d60a0462edf0d07044d21e22e (patch) | |
| tree | 900be7074ce5ae32c049e79edcb531ed4b2b1df7 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
| parent | 951cf656b2faaf6fc0baa867293c0cb0ab131951 (diff) | |
[Support] Fix alternation support in backreferences (PR60073)
backref() always performs a full match on the remaining string,
and as such also needs to be matched against the whole remaining
strip. For alternations, the match was performed against just the
sub-strip for one alternative, which would of course fail to match
the whole string.
This can be done by skipping the part of the strip between OOR1
and O_CH, so that only the first alternative in the strip is
matched, and the remaining ones are skipped. Indeed, the necessary
OOR1 skipping code was already implemented in the easy-path of
backref(), so this is clearly how it was supposed to work.
However, there were two bugs: First, under this scheme we should
be passing the stop point of the original strip, not just the
alternative sub-strip. Second, while skipping for OOR1 was
implemented, handling for O_CH was missing. This would occur when
the last alternative matches, as O_CH is preceded by an implicit
OOR1 only.
Fixes https://github.com/llvm/llvm-project/issues/60073.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions
