Hello CF community,
I encountered interesting compile error(bug?) while I was preparing contest on Hackerrank. When I run this code:
(you can open any problem and paste it on IDE part of problem), I get this type of error log:
And interesting part is that when I change "r+1" to "r" in the code, it works without problem. I do not think it stem from lack of Hackerrank's provided "stack memory". Maybe it cause because of their integrated optimizations in low level while compiling code, but I could not figure out myself. I would be happy if you share you experience if you encountered this type of problem before.
Thanks
Do you know anyone from Hackerrank who has potential on trying to fix this issue? If yes, could you please tag them or share contacts of them? Thanks
It's not a compile error. It's stack overflow. Apparently GCC fails to optimize tail call when you use
r+1
instead ofr
.