https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84833
Bug ID: 84833 Summary: [8 Regression] target_clones regression since r251047 Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- __attribute__((noipa)) void baz (void (*fn) (void)) { asm volatile ("" : "+g" (fn) : : "memory"); fn (); } __attribute__((target_clones("arch=sandybridge", "default"))) static void bar (void) { } __attribute__((target_clones("arch=sandybridge", "default"))) void foo (void) { baz (bar); } int main () { } no longer links. Even previously it has been quite broken, as 57: 0000000000400ae0 35 FUNC GLOBAL DEFAULT 13 bar._GLOBAL___baz.resolver 59: 0000000000400ae0 35 IFUNC GLOBAL DEFAULT 13 bar were exported symbols even when the function actually were declared static, but no it doesn't even link. Another (though preexisting) bug is lack of optimization, if we have a call or reference of a target_clones dispatcher in a function with the same target_clones attribute (or maybe even just target attribute or similar), we should optimize it at compile time into a reference to a particular target clone. Got into this from PR78808, the above is just an approximation of why PR78808 doesn't work on the trunk either.