me: i wish we could have tail calls in c
gcc: we have tail calls at home
the tail calls:
me: i wish we could have tail calls in c
gcc: we have tail calls at home
the tail calls:
if (1)… Good luck with the tail calls.-foptimize-sibling-calls (I think the option is)?longjmp (pls do not implement tail calls from longjmp)gdb), to the point that it's guaranteed with no way to disable it in many other programming languages, is not guaranteed when the option that turns it on is explicitly used? GCC keeps surprising me…GCC developers (a long time ago, do not hold them to it, actually it was possibly only RMS who said this): “we come from LISP and we will add many LISP-inspired extensions to standard C”
Also GCC developers: …
@wingo I had patches to improve the error message here. I cant remember what happened to them though.
Oh now I remember it was stage4 last year and I forgot to submit them during stage 1 because I was busy trying to get other tail calls working. And other optimizations happening .
Let me see if I can dig them up again and submit them for gcc 17 when stage1 opens up again.
@wingo also we fixed a lot of musttail issues during stage4 for gcc 15.
Please file a bug since it does not get tracked otherwise. Also note which target you are doing it on. Since tail calls are target dependent.
Gcc tries it's hardest at -O0 for musttail but -O0 really falls the most too.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115979
is recording at least one example of musttail error message being "other reasons". I have not looked if this is your case though.
@wingo Thanks again for the bug reports.
The fix for the musttail on the second return (first reported here in the original thread) should be easy to fix; it looks like an oversight really. There has been more testing with the C++ front-end than the C front-end when it comes to musttail due to the usage in open source has been with C++ code. (GCC's C and C++ front-end share some code but a lot of is not; this is different from clang where the parsers are even shared).
The fix for the inlining case is harder but I know what is causing it at least. I have some ideas on fixing it in a reasonable and quick fashion; as I mentioned in the bug report -fno-tree-sra is a decent workaround for now.
Note my name is different between GCC bugzilla and here.