https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109146
Bug ID: 109146 Summary: Tail call prevention in frame-address.c is not correct Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: testsuite Assignee: unassigned at gcc dot gnu.org Reporter: david.spickett at linaro dot org Target Milestone: --- With recent changes over in clang, it's now able to see through the tail call prevention used in https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.c-torture/execute/frame-address.c. The fix is pretty simple, `==` instead of `!=` will prevent the tail call. Briefly, clang is now able to work out that if the called function returns 0, the caller also returns 0, same for 1. Therefore, you can tail call the callee. check_fa_work returns 0, 0 != 0 is False, so check_fa_mid returns 0 check_fa_work returns 1, 1 != 0 is True, so check_fa_mid returns 1 As far as I can tell, gcc does not do this, yet: https://godbolt.org/z/v36zGP7f3 So it's worth fixing before gcc also starts to do this.