This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 12635 - Tail calls inside continuations cause StackOverflow
: Tail calls inside continuations cause StackOverflow
Status: NEW
Product: Runtime
Classification: Mono
Component: JIT
: unspecified
: PC Mac OS
: Normal normal
: ---
Assigned To: Bugzilla
  Show dependency treegraph
Reported: 2013-06-11 13:49 EDT by Natallie
Modified: 2015-06-23 01:06 EDT (History)
7 users (show)

See Also:


Description Natallie 2013-06-11 13:49:31 EDT
The following sample program fails with StackOverflow:

let rec f x cont =
    if x < 0 then 0
    elif x = 0 then cont x
    else f (x-1) (fun x -> f x cont)

f 250000 id

Rewriting the functions so that they all have a single parameter doesn't help
Comment 1 Alexander Kyte 2015-03-29 13:19:58 EDT
Using mono 3.12.1, this doesn't stack overflow for me. You might be using an
older mono.
Comment 2 Natallie 2015-03-30 16:36:03 EDT
Yes, that was 2 years ago. However, it still doesn't work for me:

Note You need to log in before you can comment on or make changes to this bug.