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

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

[Octave-bug-tracker] [bug #50102] dlmread crashing the interpreter on Cy


From: Rik
Subject: [Octave-bug-tracker] [bug #50102] dlmread crashing the interpreter on Cygwin
Date: Sun, 19 Mar 2017 02:15:18 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Follow-up Comment #15, bug #50102 (project octave):

@Dan: This statement is not accurate.


On the first pass, c > cmax will test true. So, right away, since r=1, rmax =
2 * max(0,1) = 2 such that rmax goes from 32 down to 2. 



The code begins by pre-assigning the value of rmax, but not cmax.


  // Start with a reasonable size to avoid constant resizing of matrix.
  octave_idx_type rmax = 32;
  octave_idx_type cmax = 0;


Next, there is a block that attempts to find the number of columns in the
data.


      // Estimate the number of columns from first line of data.
      if (cmax == 0)


The variable cmax is incremented during that process.

Only later are the number of columns and rows checked


          c = (c > j + 1 ? c : j + 1);
          if (r > rmax || c > cmax)
            {
              // Use resize_and_fill for the case of unequal length rows.
              // Keep rmax a power of 2.
              rmax = 2 * std::max (r-1, static_cast<octave_idx_type> (1));


The reason for the -1 is because the if () test is '>'.  The first time this
is triggered, for example, r will be 33 (> 32).  Thus, to keep this to a power
of 2 the code substracts one, and then multiplies by 2.

Without a failing example that can be traced through the debugger I fear not
much progress can be made on this report.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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