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

Alice Carlotti <acarlotti at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[aarch64] -march=native     |[aarch64] -march=native is
                   |reports wrong architecture  |ignored when -mtune is used
                   |name with --help=target     |
   Last reconfirmed|                            |2026-03-30
             Status|UNCONFIRMED                 |NEW
                 CC|                            |acarlotti at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Alice Carlotti <acarlotti at gcc dot gnu.org> ---
Confirmed that the code issue you found is a bug in here, but your analysis is
incorrect in several places.


Prior to GCC 13, the --help=target output for -march=native would include a
line like:
  -march=  armv8.2-a+crypto+fp16+rcpc+dotprod
(obviously the exact value is hardware dependent).


Since GCC 13, we treat -march=native as if it were -mcpu=native if there are no
explicit -mcpu or -mtune options.  This change was introduced in:

r13-2757-gdd9e5f4db2debf - aarch64: Rewrite -march=native to -mcpu if no other
-mcpu or -mtune is given

So after that commit, the --help=target output includes something like:
  -march=
  -mcpu=  ares+crc+crypto

This output is correct, because this is what the compiler is using internally.


The inconsistent skipping of the leading "V" was introduced in a later patch:

r13-2937-g00c22ba69d8e73 - aarch64: Add "V" to aarch64-arches.def names

This mismatch is a genuine bug, but it only arises when we pass both
-march=native and an explicit -mtune or -mcpu option.  This bug does affect
code generation - if you pass -march=native with an explicit -mtune option,
then the -march=native handling breaks and the option is effectively discarded,
with none of the detected features enabled.

Reply via email to