[Cython] -O3 causes MinGW to segfault python

Dave Hirschfeld dave.hirschfeld at gmail.com
Mon Apr 29 12:47:13 CEST 2013


Stefan Behnel <stefan_ml at ...> writes:

> 
> David Hirschfeld, 29.04.2013 11:58:
> > Forwarded because attachments were too large. The source files and
> > generated .c file can now be viewed at:
> > https://gist.github.com/dhirschfeld/5480711
> > 
> > Is this a bug or is the recommendation to not build with -O3?
> >
> >> Build log, segfault and version info below.
> >> Input files and generated .c file attached.
> >>
> >> C:\temp> python setup.py build_ext --inplace --force
> >> running build_ext
> >> cythoning test_o3.pyx to test_o3.c
> >> building 'test_o3' extension
> >> C:\dev\bin\MinGW32\bin\gcc.exe -march=native -mdll -O3 -Wall
> >>     -IC:\dev\bin\Python27\include -IC:\dev\bin\Python27\PC
> >>     -c test_o3.c -o build\temp.win32-2.7\Release\test_o3.o
> >> test_o3.c: In function '__Pyx_RaiseArgtupleInvalid':
> >> test_o3.c:1002:18: warning: unknown conversion type character 'z' in
> >> format [-Wformat]
> >> test_o3.c:1002:18: warning: format '%s' expects argument of type 'char 
*',
> >>                             but argument 5 has type 'Py_ssize_t' [-
Wformat]
> >> test_o3.c:1002:18: warning: unknown conversion type character 'z' in
> >> format [-Wformat]
> >> test_o3.c:1002:18: warning: too many arguments for format
> >> [-Wformat-extra-args]
> >> writing build\temp.win32-2.7\Release\test_o3.def
> >> C:\dev\bin\MinGW32\bin\gcc.exe -march=native -shared -s
> >>     build\temp.win32-2.7\Release\test_o3.o
> >> build\temp.win32-2.7\Release\test_o3.def
> >>     -LC:\dev\bin\Python27\libs -LC:\dev\bin\Python27\PCbuild -lpython27
> >> -lmsvcr90 -o
> >>     C:\temp\test_o3.pyd
> >>
> >> C:\temp> python
> >> Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit 
(Intel)]
> >> on win32
> >> Type "help", "copyright", "credits" or "license" for more information.
> >>>>> import Cython; Cython.__version__
> >> '0.19'
> >>>>> import faulthandler; faulthandler.enable()
> >>>>> from test_o3 import f
> >>>>> f(1., 2., 3., 4.)
> >> Fatal Python error: Segmentation fault
> >>
> >> Current thread 0x00001c38:
> >>   File "<stdin>", line 1 in <module>
> >>
> >> C:\temp> gcc --version
> >> gcc.exe (tdm-1) 4.7.1
> >> Copyright (C) 2012 Free Software Foundation, Inc.
> >> This is free software; see the source for copying conditions.  There is 
NO
> >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.
> 
> -O3 should generally be fine. Could you provide a stack trace of the 
crash?
> 
> Stefan
> 
> 

I don't have a debug version of Python or a gdb built with Python support on 
my Windows PC but I tried running it through gdb nonetheless with the 
following results:

C:\temp\gsl>gdb python
GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\dev\bin\Python27\python.exe...(no debugging symbols 
found)...done.
(gdb) run test.py
Starting program: C:\dev\bin\Python27\python.exe test.py
[New Thread 6208.0x18a0]

Program received signal SIGSEGV, Segmentation fault.
0x6b2c160e in ?? () from C:\temp\gsl\test_o3.pyd
(gdb) bt
#0  0x6b2c160e in ?? () from C:\temp\gsl\test_o3.pyd
#1  0x1e0bf781 in python27!PyEval_GetFuncDesc () from 
C:\dev\bin\Python27\python27.dll
#2  0x0244f0a8 in ?? ()
#3  0x1e1d57f8 in python27!PySuper_Type () from 
C:\dev\bin\Python27\python27.dll
#4  0x00000004 in ?? ()
#5  0x0203ff60 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)

Let me know if there's something else I should be doing to debug on Windows 
or if there's anything else you need to track down the problem...

Thanks,
Dave





More information about the cython-devel mailing list