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: Shai Ayal
Subject: Re: Octave chokes on this in some systems
Date: Tue, 15 Nov 2005 10:37:03 +0200
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

I think this is a very important patch. I was not able to use the 2.1.71
FC4 rpm because of this bug (to say nothing of the fact that it prevents
people from running octplot :) )

IMHO this patch should definitely go into any 2.1.72 rpm and might also
justify a 2.1.73 release

I attach the patch against 2.1.72

Shai

John W. Eaton wrote:
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);

diff -u octave-2.1.72/src/oct-obj.cc octave-2.1.72p/src/oct-obj.cc
--- octave-2.1.72/src/oct-obj.cc        2005-11-11 21:48:27.000000000 +0200
+++ octave-2.1.72p/src/oct-obj.cc       2005-11-14 12:06:41.000000000 +0200
@@ -47,22 +47,6 @@
   return true;
 }
 
-void
-octave_value_list::resize (int n, const octave_value& val)
-{
-  int len = length ();
-
-  if (n > len)
-    {
-      data.resize (n);
-
-      for (int 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)
 {
diff -u octave-2.1.72/src/oct-obj.h octave-2.1.72p/src/oct-obj.h
--- octave-2.1.72/src/oct-obj.h 2005-11-11 21:48:27.000000000 +0200
+++ octave-2.1.72p/src/oct-obj.h        2005-11-14 12:06:47.000000000 +0200
@@ -100,7 +100,21 @@
 
   void resize (int n) { data.resize (n); }
 
-  void resize (int n, const octave_value& val);
+void
+octave_value_list::resize (int n, const octave_value& val)
+{
+  int len = length ();
+
+  if (n > len)
+    {
+      data.resize (n);
+
+      for (int i = len; i < n; i++)
+        data[i] = val;
+    }
+  else if (n < len)
+    data.resize (n);
+}
 
   octave_value_list& prepend (const octave_value& val);
 


reply via email to

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