Bug 25681 - F# compiler generates code with stack overflow for trivial recursion (GCD)
Summary: F# compiler generates code with stack overflow for trivial recursion (GCD)
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-01-02 03:08 UTC by William Webber
Modified: 2017-08-28 22:59 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description William Webber 2015-01-02 03:08:41 UTC
Following simple code:

let rec gcd x y =
    if y = 0 then
        x
    else
        gcd y (x % y)

let test1 = gcd 1024 12
printfn "%d" test1

Runs correctly in fsharpi.
Compile with fsharpc; resulting executable produces error of form:

Stack overflow: IP: 0x40c25d74, fault addr: (nil)
Stacktrace:

Insert printfn statement anywhere within the gcd function, and the code works.

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