From bug-request at octave dot org Tue Jan 11 03:15:53 2005 Subject: Re: Segmentation fault? From: David Bateman To: Vic Norton Cc: Per Persson , bug@octave.org Date: Tue, 11 Jan 2005 10:16:09 +0100 Daprès Vic Norton (le 10/01/2005): > I got gbd working, David. I hadn't put in the appropriate path. I got > pretty much the same thing Per reported: > (gdb) run > Starting program: /opt/local/bin/octave > ... > octave> rrtest1D > octave> clear all > octave> quit > > Program received signal EXC_BAD_ACCESS, Could not access memory. > __tcf_0 () at oct-obj.h:153 > 153 oct-obj.h: No such file or directory. > in oct-obj.h > (gdb) bt > #0 __tcf_0 () at oct-obj.h:153 > Cannot access memory at address 0x4146870 > #1 0x9002c7b8 in exit () > #2 0x04919874 in clean_up_and_exit(int) (retval=-1610579852) at > toplev.cc:227 > ... > #11 0x000025d4 in _start (argc=1, argv=0xbffffd9c, > envp=0xbffffda4) at /SourceCache/Csu/Csu-46/crt.c:267 > #12 0x00002448 in start () > Current language: auto; currently c++ > > Without the "clear all" line there is no problem. > > Thanks for your help, David. And thank you too, Per. Vic, So you have exactly the same problem as Per.... The code causing the problem is class octave_value_list { public: ... octave_value& elem (int n) { static Matrix empty_matrix; if (n >= length ()) resize (n+1, empty_matrix); return data[n]; } ... }; where the empty_matrix is cast as an octave_value and then resize is 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); } line 153 itself in 2.1.64 is "static Matrix empty_matrix;". So it is a bit wierd to me that empty_matrix doesn't exist for you. An easy fix for this, that will be slightly less efficient would be to just delete the "static" keyword on line 153. Regards David -- David Bateman David dot Bateman at motorola dot com Motorola CRM +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------