[Bug target/126935] [17 Regression] SVE2 incorrectly detected on aarch64 vm

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126935

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kyrylo Tkachov <[email protected]>:

https://gcc.gnu.org/g:ec2890c334eaccbe37e2e2eae6a4de62fefdcbf8

commit r17-3399-gec2890c334eaccbe37e2e2eae6a4de62fefdcbf8
Author: Kyrylo Tkachov <[email protected]>
Date:   Wed Aug 19 07:14:10 2026 +0200

    libcpp: require SVE as well as SVE2 for the AArch64 lexer [PR126935]

    init_vectorized_lexer only tested HWCAP2_SVE2.  Some virtual machines
    advertise SVE2 while leaving SVE clear, which is a nonsense
    configuration but one that occurs in practice, and there the compiler
    dies as soon as it lexes anything:

      build/genmatch --gimple ...
      make[3]: *** [Makefile:3102: s-gimple-match] Illegal instruction

    Test HWCAP_SVE alongside HWCAP2_SVE2 so the run-time dispatch declines
    the SVE2 helper on such a machine and keeps using Neon.
    SVE2 without SVE is a nonsense configuration architecture-wise and
    arguably the VM hypervisor is at fault here, but it is easy to work around
    for the sake of fixing bootstrap on such machines.

    libcpp/ChangeLog:

            PR target/126935
            * lex.cc (HWCAP_SVE): Define if not already defined.
            (init_vectorized_lexer): Require HWCAP_SVE as well as
            HWCAP2_SVE2.

    Signed-off-by: Kyrylo Tkachov <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.