octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51214] Recursion fails unexpectedly at modest


From: anonymous
Subject: [Octave-bug-tracker] [bug #51214] Recursion fails unexpectedly at modest depth
Date: Fri, 9 Jun 2017 18:22:39 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586

URL:
  <http://savannah.gnu.org/bugs/?51214>

                 Summary: Recursion fails unexpectedly at modest depth
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 09 Jun 2017 10:22:38 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Segfault, Bus Error, etc.
                  Status: None
             Assigned to: None
         Originator Name: David Nichols
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.1
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

Consider the following function, taken from
https://stackoverflow.com/questions/25883247/max-recursion-depth-octave.  The
function is applied recursively 1+length(X) times to sum over X.
function [ y ] = TestSum( X )
  ## A way to implement 'sum' using recursion
    y = 0;
    if(length(X) >=1)
        y = X(end);
        X(end) = [];
        y = y + TestSum(X);
    endif
end

It works fine for X smaller than the default max_recursion_depth() == 256,
e.g. TestSum(1:100) ==>  5050 and correctly complains if the recursion depth
is too deep : TestSum(1:300) ==> error: max_recursion_depth exceeded.
Increasing the recursion depth helps some :  max_recursion_depth(512);
TestSum(1:400) ==> 80200 . However, reasonable values (less than
max_recursion_depth() ), for instance TestSum(1:400),  cause the program to
crash (or as Windows expresses it, "Stop Working").  No complaint from Octave,
just a flat-out crash.

I'm not really interesting in this particular program, but it illustrates the
problem I am having.  I'm using the octave forge statistics package 'linkage'
function which generates a binary tree as output. Attempts to traverse the
tree recursively for even modest sized input (~2000 points - hardly "big
data") generate the crash described above.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51214>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]