numpy/numpy — pull request #5223 by sturlamolden (2014-10-22 23:15:55+00:00)
Title: BUG: Ugly fix for Apple's cblas_sgemv segfault

SGEMV in Accelerate framework will segfault on MacOS X version 10.9
(aka Mavericks) if arrays are not aligned to 32 byte boundaries
and the CPU supports AVX instructions. This can produce segfaults
in numpy.dot if we use numpy.float32 as dtype. This patch overshadows
the symbols cblas_sgemv, sgemv_ and sgemv exported by Accelerate
to produce the correct behavior. The MacOS X version and CPU specs
are checked on module import. If Mavericks and AVX are detected
the call to SGEMV is emulated with a call to SGEMM if the arrays
are not 32 byte aligned. If the exported symbols cannot be
overshadowed on module import, a fatal error is produced and the
process aborts. All the fixes are in a self-contained C file
and do not alter the _dotblas C code. The patch is not applied
unless NumPy is configured to link with Apple's Accelerate
framework.