https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85100
Bug ID: 85100 Summary: __builtin_cpu_supports avx does not verify OS supports it Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jtaylor.debian at googlemail dot com Target Milestone: --- __builtin_cpu_supports("avx") checks that the cpu supports avx instructions, but without OS support the instructions cannot be used. To reproduce launch linux with the noxsave boot option. The function will return nonzero as the feature is there but programs using avx will crash with SIGILL. This makes this function significantly less useful as you need to add additional checks (using xgetbv) to verify operating system support. At least this behavior it should be more clearly documented. Not everybody is aware the operating system may not support or that you can disable it in linux with a boot option.