I'm building a scala compiler from the scala compiler source code by myself. In the source code of compiler, there are many tail-recursion functions/methods. Building scala compiler from its source code also requires compile the source code of compiler itself. If I add the option -g:notailcalls to turn off tail-recursion optimization during compiling the source code, a statck overflow error will arise when running the built compiler.
In one word, is it possible that in a big and complex scala program which has many recursive calls, leaving out the tail-recursion optimization when compiling can cause stack overflow error at run time?
def f(i: Int): Int = if (i == 0) i else f(i - 1); f(1000000)