develooper Front page | perl.perl5.porters | Postings from April 2003

[perl #21802] Segfault in 5.8.0: regexp matching

Thread Next
From:
Robert Bogomip
Date:
April 2, 2003 07:22
Subject:
[perl #21802] Segfault in 5.8.0: regexp matching
Message ID:
rt-21802-54487.3.318931702333@bugs6.perl.org
# New Ticket Created by  Robert Bogomip 
# Please include the string:  [perl #21802]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=21802 >


Perl 5.8.0 hits a limit in its regex engine. On a recent RedHat 8.0
this program generates a segfault somewhere around 7230. On Cygwin,
perl exits without complaint (!) at around 7655. (It's the prime-number
testing regexp you may have seen knocking aound the net.)

Cygwin (win2k):
  $ perl -v

  This is perl, v5.8.0 built for cygwin-multi-64int

  Copyright 1987-2002, Larry Wall

  Perl may be copied only under the terms of either the Artistic License or the
  GNU General Public License, which may be found in the Perl 5 source kit.

  Complete documentation for Perl, including FAQ lists, should be found on
  this system using `man perl' or `perldoc perl'.  If you have access to the
  Internet, point your browser at http://www.perl.com/, the Perl Home Page.

  $ perl -Wle 'for (7600..10_000) { print unless ("a" x $_) =~ /^(aa+?)\1+$/ }'
  7603
  7607
  7621
  7639
  7643
  7649
  $

Linux (RH8.0 plus updates):
  $ perl -v

  This is perl, v5.8.0 built for i386-linux-thread-multi

  Copyright 1987-2002, Larry Wall

  Perl may be copied only under the terms of either the Artistic License or the
  GNU General Public License, which may be found in the Perl 5 source kit.

  Complete documentation for Perl, including FAQ lists, should be found on
  this system using `man perl' or `perldoc perl'.  If you have access to the
  Internet, point your browser at http://www.perl.com/, the Perl Home Page.

  $ perl -Wle 'for (7200..55000) { print unless ("a" x $_) =~ /^(aa+?)\1+$/ }'
  7207
  7211
  7213
  7219
  7229
  7237
  7243
  7247
  7253
  Segmentation fault
  $

5.6.1 (ActiveState, win2k)
  $ /cygdrive/c/Tools/Lang/Perl/bin/perl -v

  This is perl, v5.6.1 built for MSWin32-x86-multi-thread
  (with 1 registered patch, see perl -V for more detail)

  Copyright 1987-2001, Larry Wall

  Binary build 631 provided by ActiveState Tool Corp. http://www.ActiveState.com
  Built 17:16:22 Jan  2 2002


  Perl may be copied only under the terms of either the Artistic License or the
  GNU General Public License, which may be found in the Perl 5 source kit.

  Complete documentation for Perl, including FAQ lists, should be found on
  this system using `man perl' or `perldoc perl'.  If you have access to the
  Internet, point your browser at http://www.perl.com/, the Perl Home Page.

Handles much larger strings, without (much) complaint:

  $ /cygdrive/c/Tools/Perl/bin/perl -Wle 'for (100_000..200_000) { print if ("a" x $_) =~ /^(aa+?)\1+$/ }'
  100000
  100001
  100002
  Complex regular subexpression recursion limit (32766) exceeded at -e line 1.
  100004
  100005
  .
  .
  .

This worked on cygwin 5.6.1 too, but I don't have access to that program
any more -- so it seems like an 5.8.0 problem.

Rgds,
-- 
Robert Bogomip /// mailto:bob.bogo@milohedge.com
Milo Hedge Ltd, OCFI, Mill Street, Oxford, OX2 0JX /// tel:+44 1865 799400


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About