https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104633
Bug ID: 104633 Summary: [12 Regression] -Winfinite-recursion diagnoses fortify wrappers Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- extern inline __attribute__((always_inline)) int memcmp (const void * p, const void *q, unsigned long size) { return __builtin_memcmp (p, q, size); } are diagnosed with t.c: In function 'memcmp': t.c:2:5: warning: infinite recursion detected [-Winfinite-recursion] 2 | int memcmp (const void * p, const void *q, unsigned long size) | ^~~~~~ t.c:4:10: note: recursive call 4 | return __builtin_memcmp (p, q, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This pattern happens in glibc fortify wrappers (but need -Wsystem-headers in addition to -Wall). It's reportedly also triggering for kernel wrappers in its fortify-string.h which does not get the benefit of doubt via -Wsystem-headers. These kind of wrappers are not recursions (I think the kernel doesn't have 'extern' on the inline), inline instances will not be called itself and __builtin_XXX are never inline expanded(?).