octave-maintainers
[Top][All Lists]
Advanced

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

Re: octave-3.0.0+ segmentation fault


From: John W. Eaton
Subject: Re: octave-3.0.0+ segmentation fault
Date: Fri, 04 Jan 2008 17:48:10 -0500

On  4-Jan-2008, Michael Goffioul wrote:

| On 1/4/08, John W. Eaton <address@hidden> wrote:
| > Please try the following patch.  I'm not sure it is the best fix, but
| > it should avoid the problem.  Maybe it would be better to arrange for
| > scope_stack to always have at least two elements with -1 at the bottom
| > of the stack.
| 
| This is what I did, but now I have another segmentation fault (however I
| don't know if it's related to the same problem). When I run a second time
| "gnuplot_binary", I get a crash with the backtrace attached (sorry, MSVC
| backtrace, less readable than gdb). Any idea?
| 
| Michael.
|       04c7e760()      
|       octinterp.dll!octave_value::operator=(const octave_value & a={...})  
Line 279 + 0x22 bytes      C++
|       octinterp.dll!out_of_date_check_internal(octave_value & function={...}) 
 Line 155 + 0x30 bytes  C++
| >     octinterp.dll!symbol_table::fcn_info::fcn_info_rep::find_autoload()  
Line 597 + 0xc bytes       C++

I don't see why the crash could happen here.

The code in quesiton is:

  octave_value
  symbol_table::fcn_info::fcn_info_rep::find_autoload (void)
  {
    octave_value retval;

    // Autoloaded function.

    if (autoload_function.is_defined ())
      out_of_date_check_internal (autoload_function);


with autoload_function an octave_value object that is a member of
fcn_info_rep and out_of_date_check_internal is


  static inline bool
  out_of_date_check_internal (octave_value& function)
  {
    bool retval = false;

    octave_function *fcn = function.function_value (true);

    if (fcn)
      {
        // FIXME -- we need to handle nested functions properly here.

        if (! fcn->is_nested_function ())
          {
            std::string ff = fcn->fcn_file_name ();

            if (! ff.empty ())
              {
                octave_time tc = fcn->time_checked ();

                bool relative = fcn->is_relative ();

                if (tc < Vlast_prompt_time
                    || (relative && tc < Vlast_chdir_time))
                  {
                    octave_time ottp = fcn->time_parsed ();
                    time_t tp = ottp.unix_time ();

                    std::string nm = fcn->name ();

                    int nm_len = nm.length ();

                    std::string file;
                    std::string dir_name;

                    if (octave_env::absolute_pathname (nm)
                        && ((nm_len > 4 && (nm.substr (nm_len-4) == ".oct"
                                            || nm.substr (nm_len-4) == ".mex"))
                            || (nm_len > 2 && nm.substr (nm_len-4) == ".m")))
                      file = nm;
                    else
                      // FIXME -- this lookup is not right since it doesn't
                      // account for dispatch type.
                      file = octave_env::make_absolute (load_path::find_fcn 
(nm, dir_name),
                                                        octave_env::getcwd ());

                    if (file.empty ())
                      {
                        // Can't see this function from current
                        // directory, so we should clear it.

                        function = octave_value ();
                      }

with the crash happening at the "function = octave_value ()"
assignment, apparently when rep is deleted in the assignment
operator.  So what is function at this point?  I think it should be an
undefined octave_value object.  What is it's rep?  What is it's
rep->count (apprently only 1 at this point, otherwise it would not be
deleted in the assignment operator)?

jwe


reply via email to

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