Menu

#613 crash on version 4.2

No version
open
nobody
None
5
2019-05-01
2019-05-01
No

It looks like Freemat 4.2 crashes in some cases of stack overflow. Here is an easy-to-reproduce example (observed with 4.2 on MacOSX 10.14.4), with a recursive implementation of the Fibonacci sequence.

function u = fibrec(n)
    % computes the n-th term of the (0,1)-Fibonacci sequence; recursive version

    a = 0;
    b = 1;

    if (n == 0)
        u = a;
    elseif (n == 1);
        u = b;
    else
        u = fibrec(n - 2) + fibrec(n - 1);
    end;
end
--> fibrec(5)
ans =
 5
--> fibrec(100)

<crash></crash>

Discussion


Log in to post a comment.