<p dir="auto">I encountered this issue at build time while testing <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="618615191" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/16246" data-hovercard-type="pull_request" data-hovercard-url="/numpy/numpy/pull/16246/hovercard" href="https://github.com/numpy/numpy/pull/16246">#16246</a> on a Haswell-based CPU supporting AVX2.</p>
<p dir="auto">This is due to a confirmed bug in GCC that is fixed since GCC 8.4: <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782" rel="nofollow">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782</a></p>
<p dir="auto">One suggested workaround on <a href="https://stackoverflow.com/a/53999574/982257" rel="nofollow">Stack Overflow</a> was to pass a number of <code class="notranslate">-ffixed-&lt;reg&gt;</code> flags to prevent GCC from producing code using the unsupported registers:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="-ffixed-xmm16 -ffixed-xmm17 -ffixed-xmm18 -ffixed-xmm19
-ffixed-xmm20 -ffixed-xmm21 -ffixed-xmm22 -ffixed-xmm23
-ffixed-xmm24 -ffixed-xmm25 -ffixed-xmm26 -ffixed-xmm27
-ffixed-xmm28 -ffixed-xmm29 -ffixed-xmm30 -ffixed-xmm31"><pre class="notranslate"><code class="notranslate">-ffixed-xmm16 -ffixed-xmm17 -ffixed-xmm18 -ffixed-xmm19
-ffixed-xmm20 -ffixed-xmm21 -ffixed-xmm22 -ffixed-xmm23
-ffixed-xmm24 -ffixed-xmm25 -ffixed-xmm26 -ffixed-xmm27
-ffixed-xmm28 -ffixed-xmm29 -ffixed-xmm30 -ffixed-xmm31
</code></pre></div>
<p dir="auto">I found that this workaround worked for me.  So a possible workaround in Numpy would be to automatically add these flags to <code class="notranslate">CFLAGS</code>, at least on Cygwin and GCC &lt; 8.4 (does Numpy's build system have an existing routine to check the compiler version?)</p>
<h3 dir="auto">Error message:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="numpy/core/src/umath/loops.c.src:3058:1: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi]
 }
 ^
numpy/core/src/umath/loops.c.src:3058:1: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]
{standard input}: Assembler messages:
{standard input}:9023: Error: invalid register for .seh_savexmm
{standard input}:9025: Error: invalid register for .seh_savexmm
{standard input}:9027: Error: invalid register for .seh_savexmm
... several more similar lines ..."><pre class="notranslate"><code class="notranslate">numpy/core/src/umath/loops.c.src:3058:1: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi]
 }
 ^
numpy/core/src/umath/loops.c.src:3058:1: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]
{standard input}: Assembler messages:
{standard input}:9023: Error: invalid register for .seh_savexmm
{standard input}:9025: Error: invalid register for .seh_savexmm
{standard input}:9027: Error: invalid register for .seh_savexmm
... several more similar lines ...
</code></pre></div>
<h3 dir="auto">Numpy/Python version information:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="1.20.0.dev0+7f7d19d 3.6.8 (default, Feb 14 2019, 22:09:48)
[GCC 7.4.0]"><pre class="notranslate"><code class="notranslate">1.20.0.dev0+7f7d19d 3.6.8 (default, Feb 14 2019, 22:09:48)
[GCC 7.4.0]
</code></pre></div>
<p dir="auto">Attempting to install numpy 1.17.3 on cygwin fails, with the only reported error message being <code class="notranslate">invalid register for .seh_savexmm</code>.<br>
I can't figure out where this would be getting called, since the reported file is <code class="notranslate">standard input</code> and grepping the source for <code class="notranslate">savexmm</code> does not produce any obvious clues.</p>
<h3 dir="auto">Reproducing code example:</h3>

<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="python3 -m pip install numpy==1.17.3"><pre class="notranslate">python3 -m pip install numpy==1.17.3</pre></div>

<h3 dir="auto">Error message:</h3>



<h4 dir="auto">Error message on third and subsequent compilations</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="...
gcc: build/src.cygwin-3.0.7-x86_64-3.5/numpy/core/src/umath/loops.c
{standard input}: Assembler messages:
{standard input}:4612: Error: invalid register for .seh_savexmm
{standard input}:4614: Error: invalid register for .seh_savexmm
{standard input}:4616: Error: invalid register for .seh_savexmm
{standard input}:4618: Error: invalid register for .seh_savexmm
{standard input}:4620: Error: invalid register for .seh_savexmm
{standard input}:4622: Error: invalid register for .seh_savexmm
{standard input}:6493: Error: invalid register for .seh_savexmm
{standard input}:6495: Error: invalid register for .seh_savexmm
{standard input}:6497: Error: invalid register for .seh_savexmm
{standard input}:6499: Error: invalid register for .seh_savexmm
{standard input}:6501: Error: invalid register for .seh_savexmm
{standard input}:6503: Error: invalid register for .seh_savexmm
{standard input}:6505: Error: invalid register for .seh_savexmm
numpy/core/src/umath/loops.c.src: In function ‘PyUFunc_e_e’:
numpy/core/src/umath/loops.c.src:77:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 }
 ^
...
numpy/core/src/umath/loops.c.src: In function ‘OBJECT_sign’:
numpy/core/src/umath/loops.c.src:2919:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 }
 ^
error: Command &quot;gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/usr/src/ports/python36/python36-3.6.9-1.x86_64/build=/usr/src/debug/python36-3.6.9-1 -fdebug-prefix-map=/usr/src/ports/python36/python36-3.6.9-1.x86_64/src/Python-3.6.9=/usr/src/debug/python36-3.6.9-1 -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/usr/src/ports/python36/python36-3.6.9-1.x86_64/build=/usr/src/debug/python36-3.6.9-1 -fdebug-prefix-map=/usr/src/ports/python36/python36-3.6.9-1.x86_64/src/Python-3.6.9=/usr/src/debug/python36-3.6.9-1 -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=1 -DHAVE_CBLAS -I/usr/local/include -I/usr/include -I/usr/include/suitesparse -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/umath -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/npymath -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/common -Inumpy/core/include -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/common -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/npymath -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/common -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/npymath -c build/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/umath/loops.c -o build/temp.cygwin-3.0.7-x86_64-3.6/build/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/umath/loops.o -MMD -MF build/temp.cygwin-3.0.7-x86_64-3.6/build/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/umath/loops.o.d&quot; failed with exit status 1
..."><pre class="notranslate"><code class="notranslate">...
gcc: build/src.cygwin-3.0.7-x86_64-3.5/numpy/core/src/umath/loops.c
{standard input}: Assembler messages:
{standard input}:4612: Error: invalid register for .seh_savexmm
{standard input}:4614: Error: invalid register for .seh_savexmm
{standard input}:4616: Error: invalid register for .seh_savexmm
{standard input}:4618: Error: invalid register for .seh_savexmm
{standard input}:4620: Error: invalid register for .seh_savexmm
{standard input}:4622: Error: invalid register for .seh_savexmm
{standard input}:6493: Error: invalid register for .seh_savexmm
{standard input}:6495: Error: invalid register for .seh_savexmm
{standard input}:6497: Error: invalid register for .seh_savexmm
{standard input}:6499: Error: invalid register for .seh_savexmm
{standard input}:6501: Error: invalid register for .seh_savexmm
{standard input}:6503: Error: invalid register for .seh_savexmm
{standard input}:6505: Error: invalid register for .seh_savexmm
numpy/core/src/umath/loops.c.src: In function ‘PyUFunc_e_e’:
numpy/core/src/umath/loops.c.src:77:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 }
 ^
...
numpy/core/src/umath/loops.c.src: In function ‘OBJECT_sign’:
numpy/core/src/umath/loops.c.src:2919:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 }
 ^
error: Command "gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/usr/src/ports/python36/python36-3.6.9-1.x86_64/build=/usr/src/debug/python36-3.6.9-1 -fdebug-prefix-map=/usr/src/ports/python36/python36-3.6.9-1.x86_64/src/Python-3.6.9=/usr/src/debug/python36-3.6.9-1 -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/usr/src/ports/python36/python36-3.6.9-1.x86_64/build=/usr/src/debug/python36-3.6.9-1 -fdebug-prefix-map=/usr/src/ports/python36/python36-3.6.9-1.x86_64/src/Python-3.6.9=/usr/src/debug/python36-3.6.9-1 -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=1 -DHAVE_CBLAS -I/usr/local/include -I/usr/include -I/usr/include/suitesparse -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/umath -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/npymath -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/common -Inumpy/core/include -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python3.6m -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/common -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/npymath -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/common -Ibuild/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/npymath -c build/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/umath/loops.c -o build/temp.cygwin-3.0.7-x86_64-3.6/build/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/umath/loops.o -MMD -MF build/temp.cygwin-3.0.7-x86_64-3.6/build/src.cygwin-3.0.7-x86_64-3.6/numpy/core/src/umath/loops.o.d" failed with exit status 1
...
</code></pre></div>
<p dir="auto">The first and second compilations produce different output before the block of errors, but are otherwise identical.</p>
<h3 dir="auto">Numpy/Python version information:</h3>
<p dir="auto">Compiling numpy 1.17.3 on python 3.5.7 fails as described above.</p>

<p dir="auto">Compiling numpy 1.17.0 on python 3.7.4 fails in the manner described above.<br>
Numpy 1.16.5 built just fine and passed most tests.</p>

<p dir="auto">How would I go about debugging this?</p>