]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* posix/regcomp.c (lower_subexp): Do not optimize empty
authorUlrich Drepper <drepper@redhat.com>
Tue, 22 Feb 2005 05:07:20 +0000 (05:07 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 22 Feb 2005 05:07:20 +0000 (05:07 +0000)
subexpressions even with REG_NOSUB.
* posix/rxspencer/tests: Add a previously failing testcase.

ChangeLog
posix/regcomp.c
posix/rxspencer/tests

index a52a9ca85ef10e319a1e4a985f9108359e0cbe4d..badf9cf22ac14ce1e2835e9c1898b806647bf302 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-10  Paolo Bonzini  <bonzini@gnu.org>
+
+       * posix/regcomp.c (lower_subexp): Do not optimize empty
+       subexpressions even with REG_NOSUB.
+       * posix/rxspencer/tests: Add a previously failing testcase.
+
 2005-02-21  Alan Modra <amodra@bigpond.net.au>
 
        * elf/dl-reloc.c (_dl_nothread_init_static_tls): Assert that dtv
index 1a5f7952c37486923fddee56f3d6bf428a55125c..a7112cffddd7f234db67e223ea99ef2516da4f2f 100644 (file)
@@ -1321,6 +1321,11 @@ lower_subexp (err, preg, node)
   bin_tree_t *op, *cls, *tree1, *tree;
 
   if (preg->no_sub
+      /* We do not optimize empty subexpressions, because otherwise we may
+        have bad CONCAT nodes with NULL children.  This is obviously not
+        very common, so we do not lose much.  An example that triggers
+        this case is the sed "script" /\(\)/x.  */
+      && node->left != NULL
       && (node->token.opr.idx >= 8 * sizeof (dfa->used_bkref_map)
          || !(dfa->used_bkref_map & (1 << node->token.opr.idx))))
     return node->left;
index a8b6e4baa82085967a8c63bbdfb200ac27164fec..b84a270cdaa3b0db6c3d0e3f9adbe5e790c0a455 100644 (file)
@@ -376,6 +376,7 @@ a(b?c)+d    -       accd    accd
 a[bc]d         -       xyzaaabcaababdacd       abd
 a[ab]c         -       aaabc   abc
 abc            s       abc     abc
+()             s       abc     @abc
 a*             &       b       @b
 
 # Let's have some fun -- try to match a C comment.