https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119718
--- Comment #12 from lucier at math dot purdue.edu --- (In reply to Jakub Jelinek from comment #7) > We can't just warn on all calls, most of them obviously aren't in tail call > positions and such warning would have extreme amounts of false positives. This statement got me wondering: when I added and tested the warning in August 2023, there were only about 300 warnings in building all of stage1 of gcc mainline: > These are the number of times this warning was triggered building stage1: > > grep warning: build.log | grep sibling | sed 's/^.*://' | sort | uniq -c > 259 callee required more stack slots than the caller > [-Wdisabled-optimization] > 43 callee returns a structure [-Wdisabled-optimization] So I added the warning to a recent mainline, and I now get many more warnings when compiling my code, for example: > _num.c:46380:13: warning: cannot apply sibling-call optimization: other > reasons [-Wdisabled-optimization] > 46380 | ___SET_F64(___F64V2,___F64FLOOR(___F64V1)) I don't understand this warning, because after macro expansion the code (plus the next line) is > ___F64V2=floor(___F64V1); > ___r1=(({unsigned long ___u64_x = ((___F64_U64)(___F64V2)).u64; ___u64_x = > ((58)==0 ? (___u64_x) : ((((unsigned long)(___u64_x))>>(58)) | (((unsigned > long)(___u64_x))<<(64-(58)))))+(6*2 + 1); ___u64_x = ((1)==0 ? (___u64_x) : > ((((unsigned long)(___u64_x))>>(1)) | (((unsigned > long)(___u64_x))<<(64-(1))))); __builtin_expect(((((((unsigned > int)(___u64_x))-(6))&(7))==0)),1) ? ((long)(___u64_x)) : (___hp += (1+1), > ___hp[-(1+1)] = (((((1)<<3))<<(3 +5))+((30)<<3)+(0)), *((double*)(___hp-1)) = > (___F64V2), (((long)(((long*)(___hp)) - (1 +(1))))+(7)));})); followed by more code. In other words, that call to floor is not in tail call position, which I understand to mean only return call(); In fact, while there is only one call in _num.c that is in tail call position, I find > grep '_num.c.*cannot' build-without-musttail-2 | wc > 285 2565 30204 I have no idea about why maybe_complain_about_tail_call is being called when processing calls that are not in tail call position. This did not happen in August 2023.