From 744eb12b7b0aa4ea0543e8dfd21b49bb5309bf93 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 22 Feb 2005 05:07:20 +0000 Subject: [PATCH] * posix/regcomp.c (lower_subexp): Do not optimize empty subexpressions even with REG_NOSUB. * posix/rxspencer/tests: Add a previously failing testcase. --- ChangeLog | 6 ++++++ posix/regcomp.c | 5 +++++ posix/rxspencer/tests | 1 + 3 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index a52a9ca85e..badf9cf22a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-02-10 Paolo Bonzini + + * 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 * elf/dl-reloc.c (_dl_nothread_init_static_tls): Assert that dtv diff --git a/posix/regcomp.c b/posix/regcomp.c index 1a5f7952c3..a7112cffdd 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -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; diff --git a/posix/rxspencer/tests b/posix/rxspencer/tests index a8b6e4baa8..b84a270cda 100644 --- a/posix/rxspencer/tests +++ b/posix/rxspencer/tests @@ -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. -- 2.11.4.GIT