octave-maintainers
[Top][All Lists]
Advanced

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

Re: Seg fault with test_sparse.m


From: John W. Eaton
Subject: Re: Seg fault with test_sparse.m
Date: Mon, 21 Aug 2006 22:37:01 -0400

On 21-Aug-2006, John W. Eaton wrote:

| On 21-Aug-2006, Joe Koski wrote:
| 
| | on 8/21/06 2:30 PM, John W. Eaton at address@hidden wrote:
| | 
| | > On 21-Aug-2006, Joe Koski wrote:
| | > 
| | > | octave:1> testls(0)
| | > | error: max_recursion_limit exceeded
| | > | error: called from `testls' in file
| | > | `/Users/jakoski/Codes/octave_test_files/testls.m'
| | > | error: called from `testls' in file
| | > | `/Users/jakoski/Codes/octave_test_files/testls.m'
| | > 
| | > Save just the function that I sent (not the stuff after the
| | > endfunction line) in a file and then run
| | > 
| | >   [save_status, save_files] = testls (0);
| | >   [load_status, load_files] = testls (1);
| | >  
| | >   for f = [save_files, load_files]
| | >     unlink (f{1});
| | >   endfor
| | > 
| | >   assert (save_status && load_status);
| | > 
| | > and there should be no recursion problem.
| | > 
| | > jwe
| | 
| | John,
| | 
| | Thanks, that solved the recursion problem. I stuck in
| | 
| |     disp('before write')
| |     a14
| |     b14
| | 
| | Immediately after all the b14 = a14, etc.
| | 
| | and 
| | 
| |       disp('after read');
| |       a14
| |       b14
| | 
| | Just before if (a14 != b14)
| | 
| | And got
| | 
| | octave:1> new_test_io
| | before write
| | a14 =
| | 
| |   7  7
| |   5  1
| | 
| | b14 =
| | 
| |   7  7
| |   5  1
| | 
| | after read
| | a14 =
| | 
| |   7  7
| |   5  1
| | 
| | b14 =
| | 
| |   7  7
| |   5  1
| | 
| | after read
| | a14 =
| | 
| |   7  7
| |   5  1
| | 
| | b14 =
| | 
| |   7  7
| |   5  1
| | 
| | after read
| | a14 =
| | 
| |   0  0
| |   0  0
| | 
| | b14 =
| | 
| |   7  7
| |   5  1
| | 
| | So, on the third attempt, it shows zeros in the matrix instead of the
| | correct values. We're getting closer. Now what?
| 
| OK.  I see the bug now, and I don't think it is specific to OS X.
| 
| Also, the checks in test.m should be of the form
| 
|   if (! isequal (a, b))
| 
| or
| 
|   if (! (a == b))
| 
| since
| 
|   if (a != b)
| 
| will only be true if ALL the elements of A and B are not equal.  D'oh,
| that's another gotcha of the "Matlab language".

Please try the follwoing patch to fix the problem with reading/writing
64-bit data types in the MAT file format.

Thanks,

jwe


src/ChangeLog:

2006-08-21  John W. Eaton  <address@hidden>

        * ls-mat5.cc (read_mat5_binary_data, read_mat5_integer_data,
        write_mat5_array): Unconditionally enable code for 64-bit int types.

 
Index: src/ls-mat5.cc
===================================================================
RCS file: /cvs/octave/src/ls-mat5.cc,v
retrieving revision 1.35
diff -u -u -r1.35 ls-mat5.cc
--- src/ls-mat5.cc      18 Aug 2006 18:05:20 -0000      1.35
+++ src/ls-mat5.cc      22 Aug 2006 02:35:36 -0000
@@ -157,16 +157,13 @@
     case miRESERVE3:
       break;
 
+    // FIXME -- how are the 64-bit cases supposed to work here?
     case miINT64:
-#ifdef int64_t
       read_doubles (is, data, LS_LONG, count, swap, flt_fmt);
-#endif
       break;
 
     case miUINT64:
-#ifdef int64_t
       read_doubles (is, data, LS_U_LONG, count, swap, flt_fmt);
-#endif
       break;
 
     case miMATRIX:
@@ -230,15 +227,11 @@
       break;
 
     case miINT64:
-#ifdef int64_t
       READ_INTEGER_DATA (int64_t, swap, m, 8, count, is);
-#endif
       break;
 
     case miUINT64:
-#ifdef int64_t
       READ_INTEGER_DATA (uint64_t, swap, m, 8, count, is);
-#endif
       break;
 
     case miMATRIX:
@@ -1104,13 +1097,9 @@
        MAT5_DO_WRITE (uint32_t, data, nel, os);
        break;
        
-       // provide for 64 bit ints, even though get_save_type does
-       // not yet implement them
-#ifdef int64_t
       case LS_U_LONG:
        MAT5_DO_WRITE (uint64_t, data, nel, os);
        break;
-#endif
 
       case LS_CHAR:
        MAT5_DO_WRITE (int8_t, data, nel, os);
@@ -1124,11 +1113,9 @@
        MAT5_DO_WRITE (int32_t, data, nel, os);
        break;
 
-#ifdef int64_t
       case LS_LONG:
        MAT5_DO_WRITE (int64_t, data, nel, os);
        break;
-#endif
 
       case LS_FLOAT:
        MAT5_DO_WRITE (float, data, nel, os);


reply via email to

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