Блог пользователя Kochekov

Автор Kochekov, история, 4 года назад, По-английски

Hello CF community,

I encountered interesting compile error(bug?) while I was preparing contest on Hackerrank. When I run this code:

Code

(you can open any problem and paste it on IDE part of problem), I get this type of error log:

Error (stderr)

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

  • Проголосовать: нравится
  • +55
  • Проголосовать: не нравится

»
4 года назад, # |
Rev. 2   Проголосовать: нравится +8 Проголосовать: не нравится

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

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

It's not a compile error. It's stack overflow. Apparently GCC fails to optimize tail call when you use r+1 instead of r.