http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55307
Bug #: 55307 Summary: libgcc's __cpu_indicator_init does not check for avx correctly Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassig...@gcc.gnu.org ReportedBy: l...@mit.edu [this is a libgcc bug, and I haven't tested it -- the test is a PITA.] One might expect that __builtin_cpu_supports("avx") would only return true if avx is usable. Unfortunately, it returns true iff avx is implemented by the cpu, regardless of whether it should be expected to work. The code should check for osxsave and then use xgetbv to see if ymm state is available. This is more or less the same bug as glibc bug 13007 [1]. There's an intel blog post on the subject at [2]. It's likely to result in crashes if old kernels are run on new hardware. Curiously, the code in gcc/testsuite/gcc.target/i386/avx-check.h appears correct. I suspect it's never been run with ymm state disabled. [1] http://sourceware.org/bugzilla/show_bug.cgi?id=13007 [2] http://software.intel.com/en-us/blogs/2011/04/14/is-avx-enabled/