Hi, there are two bugs in get_original_name. First the for loop walking list of known suffixes uses sizeos (suffixes). It evnetually walks to an empty suffix. Second problem is that strcmp may accept suffixes that are longer. I.e. mix up .isra with .israabc. This is probably not a big deal but the first bug makes get_original_name to effectively strip all suffixes, even important one on my setup.
Bootstrapped/regtesed x86_64-linux, committed. gcc/ChangeLog: * auto-profile.cc (get_original_name): Fix loop walking the suffixes. diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc index a970eb8972f..8419aa5b4a9 100644 --- a/gcc/auto-profile.cc +++ b/gcc/auto-profile.cc @@ -622,9 +638,11 @@ get_original_name (const char *name, bool alloc = true) } /* Suffixes of clones that compiler generates after auto-profile. */ const char *suffixes[] = {"isra", "constprop", "lto_priv", "part", "cold"}; - for (unsigned i = 0; i < sizeof (suffixes); ++i) + for (unsigned i = 0; i < sizeof (suffixes) / sizeof (const char *); ++i) { - if (strncmp (next_dot + 1, suffixes[i], strlen (suffixes[i])) == 0) + int len = strlen (suffixes[i]); + if (len == last_dot - next_dot - 1 + && strncmp (next_dot + 1, suffixes[i], strlen (suffixes[i])) == 0) { *next_dot = 0; return get_original_name (ret, false);