From: Inaba Hiroto Date: Sat, 16 Nov 2002 19:23:00 +0000 (+0900) Subject: UTF8 regexp {n} bug X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0e933229fa7586258708edba9d57af3dee7f48c0;p=p5sagit%2Fp5-mst-13.2.git UTF8 regexp {n} bug Message-ID: <3DD61C83.62FF9887@st.rim.or.jp> p4raw-id: //depot/perl@18179 --- diff --git a/regcomp.c b/regcomp.c index 6b35e39..50219d9 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1270,6 +1270,8 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, reg l -= old; /* Get the added string: */ last_str = newSVpvn(s + old, l); + if (UTF) + SvUTF8_on(last_str); if (deltanext == 0 && pos_before == b) { /* What was added is a constant string */ if (mincount > 1) { diff --git a/t/op/pat.t b/t/op/pat.t index 6a1d602..a6007a6 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..941\n"; +print "1..942\n"; BEGIN { chdir 't' if -d 't'; @@ -2995,4 +2995,14 @@ END print "\x{0712}" =~ /\p{Syriac1}/ ? "ok $test\n" : "not ok $test\n"; $test++; print "\x{072F}" =~ /\P{Syriac1}/ ? "ok $test\n" : "not ok $test\n"; $test++; -# last test 940 +{ + # Change #18179: previously failed with "panic: end_shift" + my $s = "\x{100}" x 5; + my $ok = $s =~ /(\x{100}{4})/; + my($ord, $len) = (ord $1, length $1); + print +($ok && $ord == 0x100 && $len == 4) + ? "ok $test\n" : "not ok $test\t# $ok/$ord/$len\n"; + ++$test; +} + +# last test 942