Description
I am getting a segfault 11 when I do a numpy.frombuffer on a buffer that's not 16-byte aligned when I start Python on the i386 architecture in OS/X. The exact same script works on the 64-bit architecture:
$ arch -i386 python
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> b = "00"+str(np.arange(20).astype(np.float64).data)
>>> np.version.version
'1.10.0.dev-251acc0'
>>> np.frombuffer(b[2:])
Segmentation fault: 11
and on the 64-bit architecture:
$ python
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> b = "00"+str(np.arange(20).astype(np.float64).data)
>>> np.version.version
'1.10.0.dev-251acc0'
>>> np.frombuffer(b[2:])
array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.,
11., 12., 13., 14., 15., 16., 17., 18., 19.])
OS/X version is 10.9.
I found this on 1.8.0, tested on 1.9 and master branch with the same result. A colleague reports that 1.7 does not have the problem and that the problem is reproduced on his machine with 1.8.
I am guessing that it's SSE-related since the problem only happens if the buffer size is greater than 32 bytes and that's probably when the conditional code decides to use SSE instead of the regular instructions for copying.