Subject: Numpy fails test suite with illegal instruction error on Core 2 Duo

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 28 Oct 2021 00:32:02 -0400

Hi,

While attempting to update numpy to 1.21.3, I encountered the following
failure only on an older Q6700 (Core2Duo) Intel processor:

--8<---------------cut here---------------start------------->8---
starting phase `check'
Building, see build.log...
    ... build in progress
    ... build in progress
    ... build in progress
Build OK
NumPy version 1.21.3
NumPy relaxed strides checking option: True
NumPy CPU features:  SSE SSE2 SSE3 SSSE3* SSE41? POPCNT? SSE42? AVX? F16C? FMA3? AVX2? AVX512F? AVX512CD? AVX512_KNL? AVX512_KNM? AVX512_SKX? AVX512_CLX? AVX512_CNL? AVX512_ICL?
........................................................................ [  0%]
..............................................................x......... [  0%]
........................................................................ [  1%]
........................................................x............... [  1%]
........................................................................ [  2%]
........................................................................ [  2%]
........................................................................ [  3%]
...........................................................ss........... [  3%]
........................................................................ [  4%]
..........................................s............................. [  4%]
........................................................................ [  5%]
x..........x..x..........x.............................................. [  5%]
..............................................s......................... [  5%]
..................................ssssssss.............................. [  6%]
...................................................................ssss. [  6%]
........................................................................ [  7%]
........................................................................ [  7%]
........................................................................ [  8%]
........................................................................ [  8%]
........................................................................ [  9%]
........................................................................ [  9%]
........................................................................ [ 10%]
........................................................................ [ 10%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 11%]
........................................................................ [ 12%]
.Fatal Python error: Illegal instruction

Current thread 0x00007ffff7833340 (most recent call first):
  File "<__array_function__ internals>", line 5 in dot
  File "/tmp/guix-build-python-numpy-1.21.3.drv-0/numpy-1.21.3/build/testenv/lib/python3.9/site-packages/numpy/core/tests/test_einsum.py", line 340 in check_einsum_sums
  File "/tmp/guix-build-python-numpy-1.21.3.drv-0/numpy-1.21.3/build/testenv/lib/python3.9/site-packages/numpy/core/tests/test_einsum.py", line 536 in test_einsum_sums_int8
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/python.py", line 183 in pytest_pyfunc_call
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/python.py", line 1641 in runtest
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/runner.py", line 162 in pytest_runtest_call
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/runner.py", line 255 in <lambda>
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/runner.py", line 311 in from_call
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/runner.py", line 254 in call_runtest_hook
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/runner.py", line 215 in call_and_report
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/runner.py", line 126 in runtestprotocol
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/runner.py", line 109 in pytest_runtest_protocol
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/main.py", line 348 in pytest_runtestloop
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/main.py", line 323 in _main
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/main.py", line 269 in wrap_session
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/main.py", line 316 in pytest_cmdline_main
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/gnu/store/jl4mf8vm840bpcqb3ks4cpyymr83khnv-python-pluggy-0.13.1/lib/python3.9/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/gnu/store/r5an02g9ddc5xncz87vyn8crib0j13bx-python-pytest-6.2.5/lib/python3.9/site-packages/_pytest/config/__init__.py", line 162 in main
  File "/tmp/guix-build-python-numpy-1.21.3.drv-0/numpy-1.21.3/build/testenv/lib/python3.9/site-packages/numpy/_pytesttester.py", line 197 in __call__
  File "/tmp/guix-build-python-numpy-1.21.3.drv-0/numpy-1.21.3/./runtests.py", line 383 in main
  File "/tmp/guix-build-python-numpy-1.21.3.drv-0/numpy-1.21.3/./runtests.py", line 700 in <module>
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "./runtests.py" arguments: ("-j" "4") exit-status: #f term-signal: 4 stop-signal: #f> 
phase `check' failed after 458.4 seconds
--8<---------------cut here---------------end--------------->8---

I'm not sure what's at cause; I have the same problem when testing
against the current 1.17.3.

Thanks,

Maxim