public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false [not found] <bug-64441-4@http.gcc.gnu.org/bugzilla/> @ 2014-12-31 10:28 ` timshen at gcc dot gnu.org 2014-12-31 14:21 ` kariya_mitsuru at hotmail dot com ` (5 subsequent siblings) 6 siblings, 0 replies; 7+ messages in thread From: timshen at gcc dot gnu.org @ 2014-12-31 10:28 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64441 --- Comment #1 from Tim Shen <timshen at gcc dot gnu.org> --- Author: timshen Date: Wed Dec 31 10:27:41 2014 New Revision: 219121 URL: https://gcc.gnu.org/viewcvs?rev=219121&root=gcc&view=rev Log: PR libstdc++/64441 * include/bits/regex.tcc (__regex_algo_impl): s/auto/auto&/. * include/bits/regex_executor.tcc (_Executor<>::_M_dfs): Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/regex.tcc trunk/libstdc++-v3/include/bits/regex_executor.tcc ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false [not found] <bug-64441-4@http.gcc.gnu.org/bugzilla/> 2014-12-31 10:28 ` [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false timshen at gcc dot gnu.org @ 2014-12-31 14:21 ` kariya_mitsuru at hotmail dot com 2015-03-09 10:07 ` redi at gcc dot gnu.org ` (4 subsequent siblings) 6 siblings, 0 replies; 7+ messages in thread From: kariya_mitsuru at hotmail dot com @ 2014-12-31 14:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64441 --- Comment #2 from Mitsuru Kariya <kariya_mitsuru at hotmail dot com> --- The rev.219121 seems to satisfy the sample code above, but does not satisfy another sample code like below. ====================================== sample code ====================================== #include <iostream> #include <regex> int main() { const char s[] = "abc"; const std::regex re("(\\d+)|(\\w+)"); std::cmatch m; std::regex_search(s, m, re); std::cout << std::boolalpha; for (size_t i = 0, n = m.size(); i <= n; ++i) { auto&& sub = m[i]; std::cout << i << ":" << sub.matched << ", str = '" << sub.str() << "', " "range = [" << sub.first - s << ", " << sub.second - s << ")" << std::endl; } } ========================================================================================= ============================= output ============================= 0:true, str = 'abc', range = [0, 3) 1:false, str = '', range = [3, 3) 2:true, str = 'abc', range = [0, 3) 3:false, str = '', range = [-140735878146800, -140735878146800) ================================================================== According to the C++11 standard 28.10.4[re.results.acc]/p.8, If n >= size() then returns a sub_match object representing an unmatched sub-expression. So, I think that n = 1 and n = 3 should be an identical result, and the output should be ============================= output ============================= 0:true, str = 'abc', range = [0, 3) 1:false, str = '', range = [3, 3) 2:true, str = 'abc', range = [0, 3) 3:false, str = '', range = [3, 3) ================================================================== ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false [not found] <bug-64441-4@http.gcc.gnu.org/bugzilla/> 2014-12-31 10:28 ` [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false timshen at gcc dot gnu.org 2014-12-31 14:21 ` kariya_mitsuru at hotmail dot com @ 2015-03-09 10:07 ` redi at gcc dot gnu.org 2015-03-09 10:08 ` redi at gcc dot gnu.org ` (3 subsequent siblings) 6 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2015-03-09 10:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64441 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2015-03-09 Ever confirmed|0 |1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false [not found] <bug-64441-4@http.gcc.gnu.org/bugzilla/> ` (2 preceding siblings ...) 2015-03-09 10:07 ` redi at gcc dot gnu.org @ 2015-03-09 10:08 ` redi at gcc dot gnu.org 2015-03-10 18:42 ` timshen at gcc dot gnu.org ` (2 subsequent siblings) 6 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2015-03-09 10:08 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64441 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kaballo86 at hotmail dot com --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- *** Bug 64781 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false [not found] <bug-64441-4@http.gcc.gnu.org/bugzilla/> ` (3 preceding siblings ...) 2015-03-09 10:08 ` redi at gcc dot gnu.org @ 2015-03-10 18:42 ` timshen at gcc dot gnu.org 2015-03-10 21:56 ` timshen at gcc dot gnu.org 2023-07-20 11:21 ` redi at gcc dot gnu.org 6 siblings, 0 replies; 7+ messages in thread From: timshen at gcc dot gnu.org @ 2015-03-10 18:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64441 --- Comment #4 from Tim Shen <timshen at gcc dot gnu.org> --- Author: timshen Date: Tue Mar 10 18:41:46 2015 New Revision: 221330 URL: https://gcc.gnu.org/viewcvs?rev=221330&root=gcc&view=rev Log: PR libstdc++/64441 * include/bits/regex.h (match_results<>::size, match_results<>::position, match_results<>::str, match_results<>::operator[], match_results<>::prefix, match_results<>::suffix, match_results<>::end, match_results<>::_M_resize, match_results<>::_M_unmatched_sub, match_results<>::_M_prefix, match_results<>::_M_suffix): Remove global __unmatched_sub. Add unmatched submatch as part of match_results. * include/bits/regex.tcc (__regex_algo_impl<>, regex_replace<>, regex_iterator<>::operator++): Adjust to use match_results::_M_prefix. * testsuite/28_regex/match_results/out_of_range_submatches.cc: New testcases. Added: trunk/libstdc++-v3/testsuite/28_regex/match_results/out_of_range_submatches.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/regex.h trunk/libstdc++-v3/include/bits/regex.tcc ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false [not found] <bug-64441-4@http.gcc.gnu.org/bugzilla/> ` (4 preceding siblings ...) 2015-03-10 18:42 ` timshen at gcc dot gnu.org @ 2015-03-10 21:56 ` timshen at gcc dot gnu.org 2023-07-20 11:21 ` redi at gcc dot gnu.org 6 siblings, 0 replies; 7+ messages in thread From: timshen at gcc dot gnu.org @ 2015-03-10 21:56 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64441 Tim Shen <timshen at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from Tim Shen <timshen at gcc dot gnu.org> --- Fixed. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false [not found] <bug-64441-4@http.gcc.gnu.org/bugzilla/> ` (5 preceding siblings ...) 2015-03-10 21:56 ` timshen at gcc dot gnu.org @ 2023-07-20 11:21 ` redi at gcc dot gnu.org 6 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2023-07-20 11:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64441 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |5.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-20 11:21 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-64441-4@http.gcc.gnu.org/bugzilla/> 2014-12-31 10:28 ` [Bug libstdc++/64441] A match_results returns an incorrect sub_match if the sub_match::matched is false timshen at gcc dot gnu.org 2014-12-31 14:21 ` kariya_mitsuru at hotmail dot com 2015-03-09 10:07 ` redi at gcc dot gnu.org 2015-03-09 10:08 ` redi at gcc dot gnu.org 2015-03-10 18:42 ` timshen at gcc dot gnu.org 2015-03-10 21:56 ` timshen at gcc dot gnu.org 2023-07-20 11:21 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).