* posix/regcomp.c (lower_subexp): Do not optimize empty

subexpressions even with REG_NOSUB.
	* posix/rxspencer/tests: Add a previously failing testcase.
This commit is contained in:
Ulrich Drepper 2005-02-22 05:07:20 +00:00
parent e13e33e279
commit 744eb12b7b
3 changed files with 12 additions and 0 deletions

View File

@ -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> 2005-02-21 Alan Modra <amodra@bigpond.net.au>
* elf/dl-reloc.c (_dl_nothread_init_static_tls): Assert that dtv * elf/dl-reloc.c (_dl_nothread_init_static_tls): Assert that dtv

View File

@ -1321,6 +1321,11 @@ lower_subexp (err, preg, node)
bin_tree_t *op, *cls, *tree1, *tree; bin_tree_t *op, *cls, *tree1, *tree;
if (preg->no_sub 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) && (node->token.opr.idx >= 8 * sizeof (dfa->used_bkref_map)
|| !(dfa->used_bkref_map & (1 << node->token.opr.idx)))) || !(dfa->used_bkref_map & (1 << node->token.opr.idx))))
return node->left; return node->left;

View File

@ -376,6 +376,7 @@ a(b?c)+d - accd accd
a[bc]d - xyzaaabcaababdacd abd a[bc]d - xyzaaabcaababdacd abd
a[ab]c - aaabc abc a[ab]c - aaabc abc
abc s abc abc abc s abc abc
() s abc @abc
a* & b @b a* & b @b
# Let's have some fun -- try to match a C comment. # Let's have some fun -- try to match a C comment.