This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix invert negative bracket match.
ClosedPublic

Authored by timshen on Sep 16 2017, 10:05 PM.

Details

Summary

Ideally we want !(neg_mask || neg_char), aka (!neg_mask && !neg_char). Before the change, the code is (!neg_mask || !neg_char).

This fixes PR34310.

Event Timeline

timshen created this revision.Sep 16 2017, 10:05 PM
timshen updated this revision to Diff 115554.Sep 16 2017, 10:09 PM

Remove "#include <iostream>" in the test. It was for debugging.

mclow.lists requested changes to this revision.Sep 19 2017, 7:06 AM

When I applied this patch locally, some of the other tests started failing.
Specifically:

Assertion failed: (!std::regex_match(s, m, std::regex("^[a-f]$", std::regex_constants::basic))), function main, file test/std/re/re.alg/re.alg.match/basic.pass.cpp, line 499.
Assertion failed: (!std::regex_match(s, m, std::regex("^[a-f]$", std::regex_constants::extended))), function main, file test/std/re/re.alg/re.alg.match/extended.pass.cpp, line 497.
Assertion failed: (!std::regex_match(s, m, std::regex("^[a-f]$"))), function main, file test/std/re/re.alg/re.alg.match/ecma.pass.cpp, line 493.
Assertion failed: (!std::regex_search(s, m, std::regex("^[a-f]$", std::regex_constants::awk))), function main, file test/std/re/re.alg/re.alg.search/awk.pass.cpp, line 560.
Assertion failed: (!std::regex_search(s, m, std::regex("^[a-f]$", std::regex_constants::basic))), function main, file test/std/re/re.alg/re.alg.search/basic.pass.cpp, line 562.
Assertion failed: (!std::regex_search(s, m, std::regex("^[a-f]$"))), function main, file test/std/re/re.alg/re.alg.search/ecma.pass.cpp, line 553.
Assertion failed: (!std::regex_search(s, m, std::regex("^[a-f]$", std::regex_constants::extended))), function main, file test/std/re/re.alg/re.alg.search/extended.pass.cpp, line 560.

all now fail for me (Mac OS 10.12)

This revision now requires changes to proceed.Sep 19 2017, 7:06 AM
timshen updated this revision to Diff 115851.Sep 19 2017, 9:16 AM
timshen edited edge metadata.

Fixed.

Those tests were XFAILing on linux-gnu. I also created D38041 to XFAIL only on the failing ones.

mclow.lists accepted this revision.Sep 19 2017, 12:41 PM

All the tests pass now (on Mac OS) Thanks!

This revision is now accepted and ready to land.Sep 19 2017, 12:41 PM
mclow.lists closed this revision.Oct 18 2017, 9:49 AM

Landed as revision 316095.