[Bug target/107551] __builtin_cpu_supports returns a negative integer for "x86-64"

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 9 13:25:40 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107551

--- Comment #25 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Martin Liska
<marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:5ec102e3290ff1cac457420a1219fa1ca3bbbb70

commit r12-8966-g5ec102e3290ff1cac457420a1219fa1ca3bbbb70
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Nov 25 13:05:56 2022 +0100

    i386: fix assert (__builtin_cpu_supports ("x86-64") >= 0)

    Similar story as PR103661, we again return a negative number
    for __builtin_cpu_supports:

    Documentation says:

    int __builtin_cpu_supports(const char *feature)
    This function returns a positive integer if the run-time CPU supports
feature and returns 0 otherwise.
    while we return -2147483648.

    Moreover, I noticed "x86-64" is not a valid option for __builtin_cpu_is,
    but for __builtin_cpu_supports.

    PR target/107551

    gcc/ChangeLog:

            * config/i386/i386-builtins.cc (fold_builtin_cpu): Use same path
            as for PR103661.
            * doc/extend.texi: Fix "x86-64" use.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/builtin_target.c: Add more checks.

    (cherry picked from commit d71b20fc30965ba8326ad9363d0aca9d61eb4ed3)


More information about the Gcc-bugs mailing list