[Pkg-octave-devel] Bug#532656: Bug#532656: octave3.2_3.2.0-1(mips/unstable): FTBFS on mips. Segfault in regression test.

John W. Eaton jwe at jweaton.org
Mon Jun 15 13:31:18 UTC 2009


On 15-Jun-2009, Rafael Laboissiere wrote:

| Attached below is a patch for pr-output.cc that makes Octave work as
| expected for 'complex(NaN,0)' on mips (and amd64 as well, FWIW).  The
| package is being built right now on mips and on amd64 and, if everything
| goes well on both arches, I will upload to unstable a new version of the
| package, octave3.2_3.2.0-2, containing the patch.
| 
| I am rushing with this because everything else is being held by this bug,
| like the upload of the new octave-forge packages.
| 
| -- 
| Rafael
| 
| ----------------------------------------------------------------------
| --- a/pr-output.cc	2009-06-15 08:48:48.000000000 +0200
| +++ b/pr-output.cc	2009-06-15 11:28:58.000000000 +0200
| @@ -852,10 +852,12 @@
|    double i_abs = ip < 0.0 ? -ip : ip;
|  
|    int r_x = r_abs == 0.0
| -    ? 0 : static_cast<int> (floor (log10 (r_abs) + 1.0));
| +    ? 0 : ((xisinf (rp) || xisnan (rp))
| +	   ? INT_MIN : static_cast<int> (floor (log10 (r_abs) + 1.0)));
|  
|    int i_x = i_abs == 0.0
| -    ? 0 : static_cast<int> (floor (log10 (i_abs) + 1.0));
| +    ? 0 : ((xisinf (ip) || xisnan (ip))
| +	   ? INT_MIN : static_cast<int> (floor (log10 (i_abs) + 1.0)));
|  
|    int x_max, x_min;

To be consistent with what is done int "set_format (double, ...)", I
think this should be

diff --git a/src/pr-output.cc b/src/pr-output.cc
--- a/src/pr-output.cc
+++ b/src/pr-output.cc
@@ -851,10 +851,10 @@
   double r_abs = rp < 0.0 ? -rp : rp;
   double i_abs = ip < 0.0 ? -ip : ip;
 
-  int r_x = r_abs == 0.0
+  int r_x = (xisinf (rp) || xisnan (rp) || xr_abs == 0.0)
     ? 0 : static_cast<int> (floor (log10 (r_abs) + 1.0));
 
-  int i_x = i_abs == 0.0
+  int i_x = (xisinf (ip) || xisnan (ip) || i_abs == 0.0)
     ? 0 : static_cast<int> (floor (log10 (i_abs) + 1.0));
 
   int x_max, x_min;


Does that work for you?  Similar changes may be needed in other
functions in case all the elements of a matrix are NaN, for example.

jwe






More information about the Pkg-octave-devel mailing list