Fix word boundary assertions under C++20#345
Open
BigRedEye wants to merge 8 commits intointel:developfrom
Open
Fix word boundary assertions under C++20#345BigRedEye wants to merge 8 commits intointel:developfrom
BigRedEye wants to merge 8 commits intointel:developfrom
Conversation
|
Hi, I believe the same problem exists here as well: hyperscan/src/util/ue2_graph.h Line 218 in f2fdb3b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In C++20 with P1614R2 implemented, zero-width assertions
\band\Bdo not work. For example, the following code fails with "Pattern can never match":This is caused by breaking change in
std::paircomparison operators (after P1614R2std::pairusesoperator<=>). The spaceship operator prefers implicit conversion tobool, if exists:https://godbolt.org/z/xnPreToW4
https://godbolt.org/z/T4cKEPrTf
So nearly all values of type
std::pair<ue2::graph_detail::vertex_descriptor, ue2::graph_detail::vertex_descriptor>compare equal: https://github.com/intel/hyperscan/blob/master/src/util/ue2_graph.h#L179-L188, soedge_cache_tis malformed: https://github.com/intel/hyperscan/blob/master/src/compiler/asserts.cpp#L284-L288, and the NFA graph after removeAssertVertices becomes disconnected.The fix is simple: just mark
operator bool()asexplicit.