Seg. fault with roots(b)
John W. Eaton
jwe at octave.org
Tue May 5 10:17:33 CDT 2009
On 6-May-2009, Robert Jenssen wrote:
| I have built debug versions of octave-3.0.5, lapack-3.2.0_1 and blas-1.0_3.
| The following is an octave session and core dump. I'm not at all familiar
| with the internals of octave or lapack but it seems that the dimensions in
| EIG::init() are correct and that the array size isn't passed properly to the
| Fortran code. Note I have used the bits of roots.m that do the work. Please
| let me know if I can help further.
|
| Regards,
|
| Rob Jenssen
|
|
| [root octave-3.0.5]./run-octave
| GNU Octave, version 3.0.5
| Copyright (C) 2008 John W. Eaton and others.
| This is free software; see the source code for copying conditions.
| There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
| FITNESS FOR A PARTICULAR PURPOSE. For details, type `warranty'.
|
| Octave was configured for "i386-unknown-freebsd7.2".
|
| Additional information about Octave is available at http://www.octave.org.
|
| Please contribute if you find this software useful.
| For more information, visit http://www.octave.org/help-wanted.html
|
| Report bugs to <bug at octave.org> (but first, please read
| http://www.octave.org/bugs.html to learn how to write a helpful report).
|
| For information about changes from previous versions, type `news'.
|
| octave:1> b=[ 6.148085718323177e-05 0.0008536007856335365 ...
| > 0.0006762894290155496 0.008536007856335364 ...
| > 0.003381447145077748 0.03841203535350914 ...
| > 0.01014434143523324 0.1024320942760244 ...
| > 0.02028868287046649 0.1792561649830427 ...
| > 0.02840415601865308 0.2151073979796512 ...
| > 0.02840415601865308 0.1792561649830427 ...
| > 0.02028868287046649 0.1024320942760244 ...
| > 0.01014434143523324 0.03841203535350914 ...
| > 0.003381447145077748 0.008536007856335364 ...
| > 0.0006762894290155495 0.0008536007856335365 ...
| > 6.148085718323177e-05];
| octave:2> l = max (size (b));
| octave:3> A = diag (ones (1, l-2), -1);
| octave:4> A(1,:) = -b(2:l) ./ b(1);
| octave:5> eig(A)
| panic: Segmentation fault: 11 -- stopping myself...
| attempting to save variables to `octave-core'...
| save to `octave-core' complete
| Segmentation fault: 11 (core dumped)
| [root octave-3.0.5]gdb66 /usr/local/src/octave/octave-3.0.5/src/octave
| octave.core
| GNU gdb 6.6 [GDB v6.6 for FreeBSD]
| Copyright (C) 2006 Free Software Foundation, Inc.
| GDB is free software, covered by the GNU General Public License, and you are
| welcome to change it and/or distribute copies of it under certain conditions.
| Type "show copying" to see the conditions.
| There is absolutely no warranty for GDB. Type "show warranty" for details.
| This GDB was configured as "i386-portbld-freebsd7.2"...
| Reading symbols
| from /usr/local/src/octave/octave-3.0.5/src/liboctinterp.so...done.
| Loaded symbols for /usr/local/src/octave/octave-3.0.5/src/liboctinterp.so
| Reading symbols
| from /usr/local/src/octave/octave-3.0.5/liboctave/liboctave.so...done.
| Loaded symbols for /usr/local/src/octave/octave-3.0.5/liboctave/liboctave.so
| Reading symbols
| from /usr/local/src/octave/octave-3.0.5/libcruft/libcruft.so...done.
| Loaded symbols for /usr/local/src/octave/octave-3.0.5/libcruft/libcruft.so
| Reading symbols from /usr/local/lib/libumfpack.so.1...done.
| Loaded symbols for /usr/local/lib/libumfpack.so.1
| Reading symbols from /usr/local/lib/libamd.so.1...done.
| Loaded symbols for /usr/local/lib/libamd.so.1
| Reading symbols from /usr/local/lib/libcamd.so.1...done.
| Loaded symbols for /usr/local/lib/libcamd.so.1
| Reading symbols from /usr/local/lib/libcolamd.so.1...done.
| Loaded symbols for /usr/local/lib/libcolamd.so.1
| Reading symbols from /usr/local/lib/libcholmod.so.1...done.
| Loaded symbols for /usr/local/lib/libcholmod.so.1
| Reading symbols from /usr/local/lib/libccolamd.so.1...done.
| Loaded symbols for /usr/local/lib/libccolamd.so.1
| Reading symbols from /usr/local/lib/libcxsparse.so.1...done.
| Loaded symbols for /usr/local/lib/libcxsparse.so.1
| Reading symbols from /usr/local/lib/libfftw3.so.4...done.
| Loaded symbols for /usr/local/lib/libfftw3.so.4
| Reading symbols from /lib/libreadline.so.7...done.
| Loaded symbols for /lib/libreadline.so.7
| Reading symbols from /lib/libncurses.so.7...done.
| Loaded symbols for /lib/libncurses.so.7
| Reading symbols from /usr/local/lib/libhdf5.so.0...done.
| Loaded symbols for /usr/local/lib/libhdf5.so.0
| Reading symbols from /lib/libz.so.4...done.
| Loaded symbols for /lib/libz.so.4
| Reading symbols from /usr/local/lib/gcc-4.3.4/libgfortran.so.3...done.
| Loaded symbols for /usr/local/lib/gcc-4.3.4/libgfortran.so.3
| Reading symbols from /lib/libm.so.5...done.
| Loaded symbols for /lib/libm.so.5
| Reading symbols from /usr/lib/libstdc++.so.6...done.
| Loaded symbols for /usr/lib/libstdc++.so.6
| Reading symbols from /lib/libgcc_s.so.1...done.
| Loaded symbols for /lib/libgcc_s.so.1
| Reading symbols from /lib/libc.so.7...done.
| Loaded symbols for /lib/libc.so.7
| Reading symbols from /lib/libthr.so.3...done.
| Loaded symbols for /lib/libthr.so.3
| Reading symbols
| from /usr/local/src/octave/octave-3.0.5/src/dispatch.oct...done.
| Loaded symbols for /usr/local/src/octave/octave-3.0.5/src/dispatch.oct
| Reading symbols
| from /usr/local/src/octave/octave-3.0.5/src/cellfun.oct...done.
| Loaded symbols for /usr/local/src/octave/octave-3.0.5/src/cellfun.oct
| Reading symbols from /usr/local/src/octave/octave-3.0.5/src/find.oct...done.
| Loaded symbols for /usr/local/src/octave/octave-3.0.5/src/find.oct
| Reading symbols from /usr/local/src/octave/octave-3.0.5/src/max.oct...done.
| Loaded symbols for /usr/local/src/octave/octave-3.0.5/src/max.oct
| Reading symbols from /usr/local/src/octave/octave-3.0.5/src/eig.oct...done.
| Loaded symbols for /usr/local/src/octave/octave-3.0.5/src/eig.oct
| Reading symbols from /libexec/ld-elf.so.1...done.
| Loaded symbols for /libexec/ld-elf.so.1
| Core was generated by `octave'.
| Program terminated with signal 11, Segmentation fault.
| #0 0x295c1e6f in dlange (norm=@0x293ff0fb, m=@0xbfbfd2a4, n=@0xbfbfd2a4,
| a=0x2b6eb000, lda=@0xbfbfd2a4, work=0xbfbfd030, _norm=1) at dlange.f:96
| 96 VALUE = MAX( VALUE, ABS( A( I, J ) ) )
| (gdb) bt
| #0 0x295c1e6f in dlange (norm=@0x293ff0fb, m=@0xbfbfd2a4, n=@0xbfbfd2a4,
| a=0x2b6eb000, lda=@0xbfbfd2a4, work=0xbfbfd030, _norm=1) at dlange.f:96
| #1 0x293154c1 in dgeev (jobvl=@0x293f99cf, jobvr=@0x293f99cf, n=@0xbfbfd2a4,
| a=0x2b6eb000, lda=@0xbfbfd2a4, wr=0x29d022f0, wi=0x29d023a0, vl=0x0,
| ldvl=@0xbfbfd298, vr=0x29d1b292, ldvr=@0xbfbfd2a4, work=0x2b900000,
| lwork=@0xbfbfd29c, info=@0xbfbfd2a0, _jobvl=1, _jobvr=1) at dgeev.f:241
| #2 0x28f150ea in EIG::init (this=0xbfbfd3c0, a=@0xbfbfd4e4, calc_ev=.FALSE.)
| at EIG.cc:125
| #3 0x2b7453ed in Feig (args=@0x2ae5b6d8, nargout=0) at ../liboctave/EIG.h:46
| #4 0x2854f1f4 in octave_builtin::do_multi_index_op (this=0x2acf80f0,
| nargout=0, args=@0x2ae5b6d8) at ov-builtin.cc:104
| #5 0x2854f926 in octave_builtin::subsref (this=0x2acf80f0, type=@0x2b6ff4e4,
| idx=@0xbfbfd784, nargout=0) at ov-builtin.cc:54
| #6 0x28518f13 in octave_value::subsref (this=0xbfbfd798, type=@0x2b6ff4e4,
| idx=@0xbfbfd784, nargout=0) at ov.cc:783
| #7 0x2867621a in tree_index_expression::rvalue (this=0x2b6ff4c0, nargout=0)
| at pt-idx.cc:352
| #8 0x2869bf2c in tree_statement::eval (this=0x2b6e82b0, silent=.FALSE.,
| nargout=0, in_function_body=<value optimized out>) at pt-stmt.cc:133
| #9 0x2869c3a8 in tree_statement_list::eval (this=0x2b6e82c0, silent=.FALSE.,
| nargout=0) at pt-stmt.cc:190
| #10 0x28460e44 in main_loop () at toplev.cc:225
| #11 0x283e1769 in octave_main (argc=5, argv=0xbfbfda98, embedded=0)
| at octave.cc:836
| #12 0x0804867a in main (argc=Cannot access memory at address 0xbfa7ffff
| ) at main.c:35
| Current language: auto; currently fortran
| (gdb) frame
| #0 0x295c1e6f in dlange (norm=@0x293ff0fb, m=@0xbfbfd2a4, n=@0xbfbfd2a4,
| a=0x2b6eb000, lda=@0xbfbfd2a4, work=0xbfbfd030, _norm=1) at dlange.f:96
| 96 VALUE = MAX( VALUE, ABS( A( I, J ) ) )
| (gdb) l
| 91 * Find max(abs(A(i,j))).
| 92 *
| 93 VALUE = ZERO
| 94 DO 20 J = 1, N
| 95 DO 10 I = 1, M
| 96 VALUE = MAX( VALUE, ABS( A( I, J ) ) )
| 97 10 CONTINUE
| 98 20 CONTINUE
| 99 ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
| 100 *
| (gdb) p I
| $1 = 48129
| (gdb) p J
| $2 = 1
| (gdb) p N
| $3 = (REF TO -> ( integer(kind=4) )) @0xbfbfd2a4: 1079508992
| (gdb) p M
| $4 = (REF TO -> ( integer(kind=4) )) @0xbfbfd2a4: 1079508992
If I'm reading this correctly, then N and M are not correct here.
Instead of being 22, they are 1079508992. What happened?
| (gdb) p A
| $5 = (PTR TO -> ( real*8 (0:-1))) 0x2b6eb000
| (gdb) up
| #1 0x293154c1 in dgeev (jobvl=@0x293f99cf, jobvr=@0x293f99cf, n=@0xbfbfd2a4,
| a=0x2b6eb000, lda=@0xbfbfd2a4, wr=0x29d022f0, wi=0x29d023a0, vl=0x0,
| ldvl=@0xbfbfd298, vr=0x29d1b292, ldvr=@0xbfbfd2a4, work=0x2b900000,
| lwork=@0xbfbfd29c, info=@0xbfbfd2a0, _jobvl=1, _jobvr=1) at dgeev.f:241
| 241 ANRM = DLANGE( 'M', N, N, A, LDA, DUM )
What is the value of N here?
| (gdb) up
| #2 0x28f150ea in EIG::init (this=0xbfbfd3c0, a=@0xbfbfd4e4, calc_ev=false)
| at EIG.cc:125
| 125 F77_XFCN (dgeev, DGEEV, (F77_CONST_CHAR_ARG2 ("N", 1),
| Current language: auto; currently c++
| (gdb) p a
| $10 = (
| const Matrix &) @0xbfbfd4e4: {<MArray2<double>> = {<Array2<double>> =
| {<Array<double>> = {_vptr$Array = 0x28991080, rep = 0x2b8117d0, dimensions =
| {
| rep = 0x2b811780}, idx = 0x0,
| idx_count = 0}, <No data fields>}, <No data fields>}, <No data
| fields>}
| (gdb) p a->dimensions->rep->dims[0]
| $13 = 22
| (gdb) p a->dimensions->rep->dims[1]
| $14 = 22
So the dimensions of A look correct. What about the value of N? It
looks like we are calling DGEEV correctly, so I don't see that this is
a bug in Octave.
jwe
More information about the Bug-octave
mailing list