Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 505960 - sys-devel/gcc-4.6 on Haswell with -march=native - {standard input}:862: Error: no such instruction: `vfmadd312ss .LC21(%rip),%xmm1,%xmm0'
Summary: sys-devel/gcc-4.6 on Haswell with -march=native - {standard input}:862: Error...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-27 12:17 UTC by Christian Schmidt
Modified: 2014-03-29 06:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
85_all_fma-instruction-typo.patch (85_all_fma-instruction-typo.patch,1.66 KB, patch)
2014-03-29 06:21 UTC, Ryan Hill (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Schmidt 2014-03-27 12:17:53 UTC
sys-devel/gcc-4.6.4 fails to build on Haswell or newer if -march=native is used:

/tmp/portage/portage/sys-devel/gcc-4.6.4/work/gcc-4.6.4/gcc/cp/pt.c: In function ‘tsubst_copy_and_build’:
/tmp/portage/portage/sys-devel/gcc-4.6.4/work/gcc-4.6.4/gcc/cp/pt.c:12620:4: warning: format not a string literal and no format arguments [-Wformat-security]
{standard input}: Assembler messages:
{standard input}:862: Error: no such instruction: `vfmadd312ss .LC21(%rip),%xmm1,%xmm0'
Makefile:1105: recipe for target 'gcov.o' failed

Apparently, the compiler will schedule instructions that are not known to the assembler if too new CPUs are used.
However, gcc-4.6.4 is the newest that can be used with nvidia's nvcc for CUDA programs, so for some users it is necessary to keep this version.


Reproducible: Always




This can be worked around with
echo 'CFLAGS="-O2 -pipe -march=corei7"' > /etc/portage/env/gcc-4.6.conf
echo '=sys-devel/gcc-4.6* gcc-4.6.conf' > /etc/portage/package.env/gcc-4.6

However, this problem does not only affect gcc itself, but also potentially programs compiled with a gcc-4.6 with -march=native. See also:

http://sourceforge.net/apps/mediawiki/ltilib/index.php?title=Compilation_hints
https://groups.google.com/forum/#!msg/moveit-users/GOvN3MOaXJ4/Xy7cxFllj3kJ
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2014-03-27 13:50:06 UTC
GCC can't build a toolchain with CFLAGS it doesn't know about.
Comment 2 Ryan Hill (RETIRED) gentoo-dev 2014-03-27 23:55:47 UTC
Ignore Jeroen.  

Yes this usually always happens with -march=native and new cpus on old versions.  Unfortunately the 4.6 branch is closed upstream and I can't track down whatever fix didn't get backported along with FMA3 support, so you'll have to forgo -march=native on 4.6.

Another work around might be -march=native -mno-fma.
Comment 3 Ryan Hill (RETIRED) gentoo-dev 2014-03-29 06:03:02 UTC
Found it.
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2014-03-29 06:21:23 UTC
Created attachment 373792 [details, diff]
85_all_fma-instruction-typo.patch
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2014-03-29 06:41:36 UTC
Fixed in 4.6.4 p1.2.