Seg. fault with roots(b)

Robert Jenssen robertjenssen at ozemail.com.au
Tue May 5 19:11:13 CDT 2009


Hi,

It seems that this is a problem inside LAPACK-3.2. On the first pass to 
dgeev.f the workspace size is calculated. In subroutine dormhr.f the matrix 
size N is corrupted. This seems to happen at dormhr.f:164. The address 
lda=@0xbfbfcda4 is that of n in the octave subroutine EIG::init() and of N in 
the calling subroutine dlaqr3. Also in dormhr, work=0xbfbfcda0. Note that

	(gdb) ptype work
	type = PTR TO -> ( real*8 (-1))

The source line:

	(gdb) 
	164	         WORK( 1 ) = LWKOPT

overwrites N.

Regards,

Rob Jenssen


[root ~]gdb66
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".
(gdb) attach 9031
Attaching to process 9031
Reading symbols from /usr/local/src/octave/octave-3.0.5/src/octave...done.
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 /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
0x29cb393b in read () from /lib/libc.so.7
(gdb) b EIG.cc:112
Breakpoint 1 at 0x28f14df6: file EIG.cc, line 112.
(gdb) b dormhr
Breakpoint 2 at 0x2933f893: file dormhr.f, line 1.
(gdb) c
Continuing.

Breakpoint 1, EIG::init (this=0xbfbfcec0, a=@0xbfbfcfe4, calc_ev=false)
    at EIG.cc:112
112	  F77_XFCN (dgeev, DGEEV, (F77_CONST_CHAR_ARG2 ("N", 1),
Current language:  auto; currently c++
(gdb) c
Continuing.

Breakpoint 2, dormhr (side=@0x293ff4b1, trans=@0x293ff4b0, m=@0xbfbf7914, 
    n=@0xbfbf7914, ilo=@0x293ff4ac, ihi=@0xbfbf78e8, a=0x2b82c000, 
    lda=@0xbfbfcda4, tau=0xbfbfcd88, c=0x2b82c000, ldc=@0xbfbfcda4, 
    work=0xbfbfcda0, lwork=@0x293ff4a8, info=@0xbfbf791c, _side=1, _trans=1)
    at dormhr.f:1
1	      SUBROUTINE DORMHR( SIDE, TRANS, M, N, ILO, IHI, A, LDA, TAU, C,
Current language:  auto; currently fortran
gdb) info source
Current source file is dormhr.f
Compilation directory is /usr/local/src/lapack/lapack-3.2/SRC
Located in /usr/local/src/lapack/lapack-3.2/SRC/dormhr.f
Contains 201 lines.
Source language is fortran.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
(gdb) bt
#0  dormhr (side=@0x293ff4b1, trans=@0x293ff4b0, m=@0xbfbf7914, n=@0xbfbf7914, 
    ilo=@0x293ff4ac, ihi=@0xbfbf78e8, a=0x2b82c000, lda=@0xbfbfcda4, 
    tau=0xbfbfcd88, c=0x2b82c000, ldc=@0xbfbfcda4, work=0xbfbfcda0, 
    lwork=@0x293ff4a8, info=@0xbfbf791c, _side=1, _trans=1) at dormhr.f:1
#1  0x2932f213 in dlaqr3 (wantt=@0xbfbfc9a8, wantz=@0xbfbfc9a4, n=@0xbfbfcda4, 
    ktop=@0x293ff0dc, kbot=@0xbfbfcda4, nw=@0xbfbf7b3c, h=0x2b82c000, 
    ldh=@0xbfbfcda4, iloz=@0x293ff0dc, ihiz=@0xbfbfcda4, z=0x29d1b292, 
    ldz=@0xbfbfcda4, ns=@0xbfbf7b64, nd=@0xbfbf7b68, sr=0x29d02240, 
    si=0x29d022f0, v=0x2b82c000, ldv=@0xbfbfcda4, nh=@0xbfbfcda4, 
    t=0x2b82c000, ldt=@0xbfbfcda4, nv=@0xbfbfcda4, wv=0x2b82c000, 
    ldwv=@0xbfbfcda4, work=0xbfbfcd88, lwork=@0x293ff478) at dlaqr3.f:199
#2  0x2932dc15 in dlaqr0 (wantt=@0xbfbfc9a8, wantz=@0xbfbfc9a4, n=@0xbfbfcda4, 
    ilo=@0x293ff0dc, ihi=@0xbfbfcda4, h=0x2b82c000, ldh=@0xbfbfcda4, 
    wr=0x29d02240, wi=0x29d022f0, iloz=@0x293ff0dc, ihiz=@0xbfbfcda4, 
    z=0x29d1b292, ldz=@0xbfbfcda4, work=0xbfbfcd88, lwork=@0x293ff0e8, 
    info=@0xbfbfcda0) at dlaqr0.f:286
#3  0x29328403 in dhseqr (job=@0x293ff0f3, compz=@0x293ff0d5, n=@0xbfbfcda4, 
    ilo=@0x293ff0dc, ihi=@0xbfbfcda4, h=0x2b82c000, ldh=@0xbfbfcda4, 
    wr=0x29d02240, wi=0x29d022f0, z=0x29d1b292, ldz=@0xbfbfcda4, 
    work=0xbfbfcd88, lwork=@0x293ff0e8, info=@0xbfbfcda0, _job=1, _compz=1)
    at dhseqr.f:315
#4  0x29315313 in dgeev (jobvl=@0x293f99cf, jobvr=@0x293f99cf, n=@0xbfbfcda4, 
    a=0x2b82c000, lda=@0xbfbfcda4, wr=0x29d02240, wi=0x29d022f0, vl=0x0, 
    ldvl=@0xbfbfcd98, vr=0x29d1b292, ldvr=@0xbfbfcda4, work=0xbfbfcd88, 
    lwork=@0xbfbfcd9c, info=@0xbfbfcda0, _jobvl=1, _jobvr=1) at dgeev.f:205
#5  0x28f14edd in EIG::init (this=0xbfbfcec0, a=@0xbfbfcfe4, calc_ev=.FALSE.)
    at EIG.cc:112
#6  0x2b7453ed in Feig (args=@0x2aeb33a8, nargout=1) at ../liboctave/EIG.h:46
#7  0x2854f1f4 in octave_builtin::do_multi_index_op (this=0x2acf80f0, 
    nargout=1, args=@0x2aeb33a8) at ov-builtin.cc:104
#8  0x2854f926 in octave_builtin::subsref (this=0x2acf80f0, type=@0x2b6ff464, 
    idx=@0xbfbfd284, nargout=1) at ov-builtin.cc:54
#9  0x28518f13 in octave_value::subsref (this=0xbfbfd298, type=@0x2b6ff464, 
    idx=@0xbfbfd284, nargout=1) at ov.cc:783
#10 0x2867621a in tree_index_expression::rvalue (this=0x2b6ff440, nargout=1)
    at pt-idx.cc:352
#11 0x2867266f in tree_index_expression::rvalue (this=0x2b6ff440)
    at pt-idx.cc:363
#12 0x2865b32f in tree_simple_assignment::rvalue (this=0x2ae5b6d0)
    at pt-assign.cc:205
#13 0x2865a5e5 in tree_simple_assignment::rvalue (this=0x2ae5b6d0, nargout=0)
---Type <return> to continue, or q <return> to quit---
    at pt-assign.cc:184
#14 0x2869bf2c in tree_statement::eval (this=0x2aeb6140, silent=.FALSE., 
    nargout=0, in_function_body=<value optimized out>) at pt-stmt.cc:133
#15 0x2869c3a8 in tree_statement_list::eval (this=0x2aeb6150, 
    silent=20 '\024', nargout=0) at pt-stmt.cc:190
#16 0x283f642a in parse_and_execute (f=0x29cd8420) at parse.y:2875
#17 0x283f6977 in ?? () at oct-errno.cc:622
   from /usr/local/src/octave/octave-3.0.5/src/liboctinterp.so
#18 0x283f7314 in load_fcn_from_file (nm_arg=@0xbfbfd738, exec_script=160 ' ')
    at parse.y:3469
#19 0x283f7654 in load_fcn_from_file (sym_rec=0x2b693230, 
    exec_script=20 '\024') at parse.y:3491
#20 0x2847cbf9 in lookup (sym_rec=0x2b693230, exec_script=20 '\024')
    at variables.cc:1127
#21 0x2866f8e0 in tree_identifier::do_lookup (this=0x2afe1b60, 
    script_file_executed=@0xbfbfd7fb, exec_script=<value optimized out>)
    at pt-id.cc:110
#22 0x2869bedc in tree_statement::eval (this=0x2aeb4110, silent=.FALSE., 
    nargout=0, in_function_body=<value optimized out>) at pt-stmt.cc:124
#23 0x2869c3a8 in tree_statement_list::eval (this=0x2aeb4130, 
    silent=20 '\024', nargout=0) at pt-stmt.cc:190
#24 0x28460e44 in main_loop () at toplev.cc:225
#25 0x283e1769 in octave_main (argc=5, argv=0xbfbfda88, embedded=0)
    at octave.cc:836
#26 0x0804867a in main (argc=Cannot access memory at address 0x3
) at main.c:35
(gdb) p N
$1 = (REF TO -> ( integer(kind=4) )) @0xbfbf7914: 3
(gdb) up
#1  0x2932f213 in dlaqr3 (wantt=@0xbfbfc9a8, wantz=@0xbfbfc9a4, n=@0xbfbfcda4, 
    ktop=@0x293ff0dc, kbot=@0xbfbfcda4, nw=@0xbfbf7b3c, h=0x2b82c000, 
    ldh=@0xbfbfcda4, iloz=@0x293ff0dc, ihiz=@0xbfbfcda4, z=0x29d1b292, 
    ldz=@0xbfbfcda4, ns=@0xbfbf7b64, nd=@0xbfbf7b68, sr=0x29d02240, 
    si=0x29d022f0, v=0x2b82c000, ldv=@0xbfbfcda4, nh=@0xbfbfcda4, 
    t=0x2b82c000, ldt=@0xbfbfcda4, nv=@0xbfbfcda4, wv=0x2b82c000, 
    ldwv=@0xbfbfcda4, work=0xbfbfcd88, lwork=@0x293ff478) at dlaqr3.f:199
199	     $                WORK( JW+1 ), -1, INFO )
(gdb) p N
$2 = (REF TO -> ( integer(kind=4) )) @0xbfbfcda4: 22
(gdb) do
#0  dormhr (side=@0x293ff4b1, trans=@0x293ff4b0, m=@0xbfbf7914, n=@0xbfbf7914, 
    ilo=@0x293ff4ac, ihi=@0xbfbf78e8, a=0x2b82c000, lda=@0xbfbfcda4, 
    tau=0xbfbfcd88, c=0x2b82c000, ldc=@0xbfbfcda4, work=0xbfbfcda0, 
    lwork=@0x293ff4a8, info=@0xbfbf791c, _side=1, _trans=1) at dormhr.f:1
1	      SUBROUTINE DORMHR( SIDE, TRANS, M, N, ILO, IHI, A, LDA, TAU, C,
(gdb) n
122	      INFO = 0
(gdb) 
123	      NH = IHI - ILO
(gdb) 
124	      LEFT = LSAME( SIDE, 'L' )
(gdb) 
125	      LQUERY = ( LWORK.EQ.-1 )
(gdb) 
129	      IF( LEFT ) THEN
(gdb) 
133	         NQ = N
(gdb) 
134	         NW = M
(gdb) 
136	      IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
(gdb) 
157	      IF( INFO.EQ.0 ) THEN
(gdb) 
158	         IF( LEFT ) THEN
(gdb) 
161	            NB = ILAENV( 1, 'DORMQR', SIDE // TRANS, M, NH, NH, -1 )
(gdb) 
163	         LWKOPT = MAX( 1, NW )*NB
(gdb) 
164	         WORK( 1 ) = LWKOPT
(gdb) 
167	      IF( INFO.NE.0 ) THEN
(gdb) 
197	      RETURN
(gdb) up
#1  0x2932f213 in dlaqr3 (wantt=@0xbfbfc9a8, wantz=@0xbfbfc9a4, n=@0xbfbfcda4, 
    ktop=@0x293ff0dc, kbot=@0xbfbfcda4, nw=@0xbfbf7b3c, h=0x2b82c000, 
    ldh=@0xbfbfcda4, iloz=@0x293ff0dc, ihiz=@0xbfbfcda4, z=0x29d1b292, 
    ldz=@0xbfbfcda4, ns=@0xbfbf7b64, nd=@0xbfbf7b68, sr=0x29d02240, 
    si=0x29d022f0, v=0x2b82c000, ldv=@0xbfbfcda4, nh=@0xbfbfcda4, 
    t=0x2b82c000, ldt=@0xbfbfcda4, nv=@0xbfbfcda4, wv=0x2b82c000, 
    ldwv=@0xbfbfcda4, work=0xbfbfcd88, lwork=@0x293ff478) at dlaqr3.f:199
199	     $                WORK( JW+1 ), -1, INFO )
(gdb) p N
$3 = (REF TO -> ( integer(kind=4) )) @0xbfbfcda4: 1079508992
(gdb) q
The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /usr/local/src/octave/octave-3.0.5/src/octave, process 
9031




More information about the Bug-octave mailing list