[Top][All Lists]

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

Possible bug site

From: Al Niessner
Subject: Possible bug site
Date: 21 Dec 2002 23:22:09 -0500

While digging though the octave code (2.1.40) I found a potential
problem. When calling the function matrix_value() from
args(0).matrix_value in the following example:

#include <octave/oct.h>

DEFUN_DLD (testDynamicFunc, args, orgs, "Test Dynamic Functions.")
  Matrix test1 = args(0).matrix_value();

  for (int r = 0 ; r < test1.rows() ; r++)
    for (int c = 0 ; c < test1.cols() ; c++)
        test1(r,c) = test1(r,c)*2.0;

  return octave_value(test1);

The code execution traverses the call stack to Array.h:157 because
HEAVYWEIGHT_INDEXING is defined where it executes the following line:

      max_indices = a.max_indices;

As it then crawls back up the call stack it gets to Array2.h:92 where it
executes the following line:

      set_max_indices (2);

I do not know if a.max_indices can ever vary from 2 since the call stack
looks something like Array2.h:89 -call-> Array.h:153-159 -return->
Array2.h:90... If it does or can, then I would think that this is a bug.
Otherwise it is just a bit strange.

Thought you may want to know.

Al Niessner

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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