[Cython] -O3 causes MinGW to segfault python

Stefan Behnel stefan_ml at behnel.de
Mon Apr 29 12:10:13 CEST 2013


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



More information about the cython-devel mailing list