aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2011-02-17 01:47:21 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2011-02-17 01:47:21 +0000
commit948ef710603fc3528706f3d9c2c8e5644d12c95f (patch)
tree1022bf572007051927ff62431b3464309c6ec14b
parentbde8d7f701ed6123f5cb0183a414148f50bd61f7 (diff)
downloadgcc-948ef710603fc3528706f3d9c2c8e5644d12c95f.zip
gcc-948ef710603fc3528706f3d9c2c8e5644d12c95f.tar.gz
gcc-948ef710603fc3528706f3d9c2c8e5644d12c95f.tar.bz2
re PR libstdc++/47724 ([C++0x] Regex string anchors cause segfault)
2011-02-17 Jonathan Wakely <jwakely.gcc@gmail.com> PR libstdc++/47724 * include/bits/regex_compiler.h (_Scanner::_M_advance): Do not treat line anchors as metacharacters. * testsuite/28_regex/basic_regex/ctors/47724.cc: New. From-SVN: r170236
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.h4
-rw-r--r--libstdc++-v3/testsuite/28_regex/basic_regex/ctors/47724.cc34
3 files changed, 45 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a72c1bf..7753341 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-17 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/47724
+ * include/bits/regex_compiler.h (_Scanner::_M_advance): Do not treat
+ line anchors as metacharacters.
+ * testsuite/28_regex/basic_regex/ctors/47724.cc: New.
+
2011-02-16 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/47773
diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index b979c8d..f581e64 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -171,6 +171,9 @@ namespace __regex
_M_scan_in_brace();
return;
}
+#if 0
+ // TODO: re-enable line anchors when _M_assertion is implemented.
+ // See PR libstdc++/47724
else if (_M_state & _S_state_at_start && __c == _M_ctype.widen('^'))
{
_M_curToken = _S_token_line_begin;
@@ -183,6 +186,7 @@ namespace __regex
++_M_current;
return;
}
+#endif
else if (__c == _M_ctype.widen('.'))
{
_M_curToken = _S_token_anychar;
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/47724.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/47724.cc
new file mode 100644
index 0000000..7a744bb
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/47724.cc
@@ -0,0 +1,34 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// PR libstdc++/47724
+
+#include <regex>
+
+void test01()
+{
+ std::regex s("^$");
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+};