https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118442
Bug ID: 118442 Summary: -fprofile-generate wrongly adds instrumentation after musttail call Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: kenjin4096 at gmail dot com Target Milestone: --- Please see: https://godbolt.org/z/5sfcxqhdb Removing `-fprofile-generate` causes GCC 15 to compile successfully. With `-fprofile-generate` compilation fails. If my understanding is correct (and thanks to Andrew), instrumentation is being added after the tail call, which triggers the tail call compilation error message. <bb 6> [local count: 1073741824]: # DEBUG BEGIN_STMT buffer_2(D)->test[0] = 4; # DEBUG BEGIN_STMT resolveToBufferSlow (buffer_2(D)); [must tail call] PROF_edge_counter_7 = __gcov0._Z15resolveToBufferP4Span[1]; PROF_edge_counter_8 = PROF_edge_counter_7 + 1; __gcov0._Z15resolveToBufferP4Span[1] = PROF_edge_counter_8; Thank you.