build-time popcnt test completes successfully when it should fail #19067
Labels
00 - Bug
36 - Build
Build related PR
component: numpy.distutils
component: SIMD
Issues in SIMD (fast instruction sets) code or machinery
Building numpy 1.20 with gcc-9.2 or 10.2 on cpus that don't support the popcnt instruction produces code that fails at run time when numpy is imported. The issue appears to be that the test to see if popcnt functions, in cpu_popcnt.c, succeeds even when it should fail. The code that's there, when compiled with -S (with or without optimization) produces no popcnt instructions in its output. Probably this could be fixed by executing popcnt on a value that is not known at compile time - perhaps a random number, or a pid?
Another alternative might be to use a similar test at compile time as is used at run-time, where it appears that a cpu register is checked to see if popcnt is available.
More details at https://bugs.gentoo.org/788184
The text was updated successfully, but these errors were encountered: