help-octave
[Top][All Lists]
Advanced

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

Re: Octave chokes on this in some systems


From: John W. Eaton
Subject: Re: Octave chokes on this in some systems
Date: Sun, 13 Nov 2005 23:51:15 -0500

On 13-Nov-2005, Quentin Spencer wrote:

| Shai Ayal wrote:
| 
| > Just to add to the general confusion it runs well on my NOT vanilla 
| > (shall we say chocolate?) FC4 with octave 2.1.71 where all octave 
| > stuff is compiled using gcc-3.2.3:
| >
| > `mkoctfile -p CXX` -v
| > Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
| > Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
| > --infodir=/usr/share/info --enable-shared --enable-threads=posix 
| > --disable-checking --with-system-zlib --enable-__cxa_atexit 
| > --enable-languages=c,c++,f77 --disable-libgcj --host=i386-redhat-linux
| > Thread model: posix
| > gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47.fc4)
| 
| 
| Actually, I think this helps clear up the confusion. We seem to have a 
| pattern here: it breaks with gcc 4 and it works with gcc 3.

The following change to Octave will allow the test_caller/test_callee
functions to work with GCC 4.0.2, at least on my system (Debian x86
testing, everything compiled with GCC 4.0.2).  But since the only
change to Octave is to move the function definition from a .cc file to
a .h file, this does seem to indicate a bug of some sort in GCC or
libstdc++ (octave_value_list is implemented using a std::vector
object).

The crash was happening in the octave_value_list destructor.  Maybe
the problem is similar to this one:

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196

?

The diff is relative to the current CVS.  To apply it to older
sources, change octave_idx_type to int.  Or, just make the same change
by hand (move the definition of the resize function from oct-obj.cc to
oct-obj.h).

jwe


Index: src/oct-obj.cc
===================================================================
RCS file: /cvs/octave/src/oct-obj.cc,v
retrieving revision 1.33
diff -u -r1.33 oct-obj.cc
--- src/oct-obj.cc      26 Apr 2005 19:24:33 -0000      1.33
+++ src/oct-obj.cc      14 Nov 2005 04:43:09 -0000
@@ -43,22 +43,6 @@
   return true;
 }
 
-void
-octave_value_list::resize (octave_idx_type n, const octave_value& val)
-{
-  octave_idx_type len = length ();
-
-  if (n > len)
-    {
-      data.resize (n);
-
-      for (octave_idx_type i = len; i < n; i++)
-       data[i] = val;
-    }
-  else if (n < len)
-    data.resize (n);
-}
-
 octave_value_list&
 octave_value_list::prepend (const octave_value& val)
 {
Index: src/oct-obj.h
===================================================================
RCS file: /cvs/octave/src/oct-obj.h,v
retrieving revision 1.48
diff -u -r1.48 oct-obj.h
--- src/oct-obj.h       26 Apr 2005 19:24:33 -0000      1.48
+++ src/oct-obj.h       14 Nov 2005 04:43:09 -0000
@@ -96,7 +96,20 @@
 
   void resize (octave_idx_type n) { data.resize (n); }
 
-  void resize (octave_idx_type n, const octave_value& val);
+  void resize (octave_idx_type n, const octave_value& val)
+    {
+      octave_idx_type len = length ();
+
+      if (n > len)
+       {
+         data.resize (n);
+
+         for (octave_idx_type i = len; i < n; i++)
+           data[i] = val;
+       }
+      else if (n < len)
+       data.resize (n);
+    }
 
   octave_value_list& prepend (const octave_value& val);
 



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

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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