https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89014
--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> --- The obvious fix: diff --git a/gcc/config/aarch64/driver-aarch64.c b/gcc/config/aarch64/driver-aarch64.c index 2bf1f9a8c13..100e0c3529c 100644 --- a/gcc/config/aarch64/driver-aarch64.c +++ b/gcc/config/aarch64/driver-aarch64.c @@ -178,7 +178,6 @@ host_detect_local_cpu (int argc, const char **argv) unsigned int variants[2] = { ALL_VARIANTS, ALL_VARIANTS }; unsigned int n_variants = 0; bool processed_exts = false; - const char *ext_string = ""; unsigned long extension_flags = 0; unsigned long default_flags = 0; @@ -348,11 +347,12 @@ host_detect_local_cpu (int argc, const char **argv) if (tune) return res; - ext_string - = aarch64_get_extension_string_for_isa_flags (extension_flags, - default_flags).c_str (); - - res = concat (res, ext_string, NULL); + { + std::string extension + = aarch64_get_extension_string_for_isa_flags (extension_flags, + default_flags); + res = concat (res, extension.c_str (), NULL); + } return res; fixes the valgrind error, but (on this box) leads to: $ ./xgcc -B. -c test.c -march=native Assembler messages: Error: unknown architectural extension `rng+memtag+sb+ssbs+predres' Error: unrecognized option -march=armv8-a+profile+rng+memtag+sb+ssbs+predres