seg-fault of octave on MacOSX

John W. Eaton jwe at bevo.che.wisc.edu
Thu Dec 6 12:17:56 CST 2007


On  6-Dec-2007, Jean-François Mertens wrote:

| 
| On 05 Dec 2007, at 22:43, John W. Eaton wrote:
| 
| > On  5-Dec-2007, Jean-François Mertens wrote:
| >
| > | So this seems really a compiler problem (and specific to the Mac-
| > | Intel back-end?),
| > | that we have to solve for ourselves _ if we can just hope for your
| > | guidance
| > | in reducing this to an example not involving octave ..
| >
| > I have no idea what I can do to help you.  As I've mentioned before, I
| > don't have a Mac OS X system, so I can't debug this problem.
| 
| The problem occurs at the last command, "end_unwind_protect" , of the
| first test in ov_fcn_handle.cc (line 683).

The test is:

  a = 2;
  f = @(x) a + x;
  g = @(x) 2 * x;
  h = @log2;
  f2 = f;
  g2 = g;
  h2 = h;
  nm = tmpnam();
  unwind_protect
    save ("-binary", nm, "f2", "g2", "h2");
    clear f2 g2 h2
    load (nm);
    assert (f(2),f2(2));
    assert (g(2),g2(2));
    assert (g(3),g2(3));
    unlink (nm);
    save ("-binary", nm, "f2", "g2", "h2");
  unwind_protect_cleanup
    unlink (nm);
  end_unwind_protect

| Under gdb, this gives the following backtrace:
| 
|   ...
|  > end_unwind_protect
| 
| Program received signal EXC_BAD_ACCESS, Could not access memory.
| Reason: KERN_INVALID_ADDRESS at address: 0x756f6d79
| 0x756f6d79 in ?? ()
| (gdb) bt
| #0  0x756f6d79 in ?? ()
| #1  0x1176fd10 in std::basic_filebuf<char, std::char_traits<char>  
|  >::_M_terminate_output (this=0x12ec40b0) at /sw/.bld/ 
| gcc42-4.2.2-1000/darwin_objdir/i686-apple-darwin8/libstdc++-v3/ 
| include/bits/fstream.tcc:765
| #2  0x010e1f59 in save_vars (os=@0xbfff7fa8, pattern=@0x12ec3fa8,  
| fmt=LS_BINARY, save_as_floats=-1073775180) at load-save.cc:1122
| #3  0x010e7e96 in save_vars (argv=@0xbfff7fb0, argv_idx=-1073774976,  
| argc=6, os=@0xbfff7fb0, fmt=LS_BINARY, save_as_floats=0,  
| write_header_info=1) at load-save.cc:1321
| #4  0x010e8f68 in Fsave (args=@0x12ec3ee8) at /usr/include/c++/4.0.0/ 
| fstream:647

Since the crash is happening inside of Fsave, I think it must be one
of the lines

    save ("-binary", nm, "f2", "g2", "h2");

What happens if you just execute

  a = 2;
  f = @(x) a + x;
  g = @(x) 2 * x;
  h = @log2;
  f2 = f;
  g2 = g;
  h2 = h;
  nm = tmpnam();
  save ("-binary", nm, "f2", "g2", "h2");

Does that fail?

jwe



More information about the Bug-octave mailing list