[Python-Dev] New re failures on Windows

Andrew MacIntyre andymac@bullseye.apana.org.au
Mon, 21 Apr 2003 12:01:34 +1100 (edt)

On Sat, 19 Apr 2003, Tim Peters wrote:

> test_sre is dying with a segfault:
> """
> C:\Code\python\PCbuild>python ../lib/test/test_sre.py
> Running tests on character literals
> Running tests on sre.search and sre.match
> sre.match(r'(a)?a','a').lastindex FAILED
> expected None
> got result 1
> sre.match(r'(a)(b)?b','ab').lastindex FAILED
> expected 1
> got result 2
> sre.match(r'(?P<a>a)(?P<b>b)?b','ab').lastgroup FAILED
> expected 'a'
> got result 'b'
> Running tests on sre.sub
> Running tests on symbolic references
> Running tests on sre.subn
> Running tests on sre.split
> Running tests on sre.findall
> Running tests on sre.finditer
> Running tests on sre.match
> Running tests on sre.escape
> Running tests on sre.Scanner
> Pickling a SRE_Pattern instance
> Test engine limitations
> """
> and it dies with a segfault there.  Unfortunately, test_sre doesn't die in a
> debug build.

Compiler optimisation?  I've been trying to get a handle on this for the
last couple of days, with various versions of gcc on FreeBSD and OS/2 not
liking _sre since Guido checked patch #720991 in on April 14.

The failures all occur after the "Running tests on sre.search and
sre.match" phase of test_sre.

What I've been able to delineate thus far:

test_sre on FreeBSD 4.[47]:
  gcc 2.95.[34]:  -O3     => bus error, -O2 => Ok
  gcc 3.2.2:      -O[023] =>  "    "  , -Os => Ok

test_sre on OS/2:
  gcc 2.8.1:      -O2     => Ok
  pgcc 2.95.2:    -O3     => Ok
  gcc 3.2.1:      -O[23]  => SYS3171, -O[0s] => Ok
  OpenWatcom 1.0 with all optimisations enabled => Ok

Now, the docs for SYS3171 on OS/2 say

"EXPLANATION: The process was terminated without running exception
handlers because there was not enough room left on the stack to
dispatch the exception.  This is typically caused by exceptions
occurring in exception handlers."

I did bump the stack from 1M to 2M with no effect.

I'm not concerned by the failures on OS/2 as I'm not using autoconf there,
and I can special-case _sre.c easily.

I am concerned about the failures on FreeBSD.  It looks to me as though
the only viable option is to just special case FreeBSD/gcc in configure.in
and use -Os instead of -O3.

I've been assuming that test_sre has passed with gcc 3.2.x -O3 on Linux
since that checkin.

Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac@bullseye.apana.org.au  | Snail: PO Box 370
        andymac@pcug.org.au            |        Belconnen  ACT  2616
Web:    http://www.andymac.org/        |        Australia