octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #50068] Segfault, when eval_string is used in


From: Dmitry Messerman
Subject: [Octave-bug-tracker] [bug #50068] Segfault, when eval_string is used in interpreter embedded mode
Date: Wed, 18 Jan 2017 10:09:27 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0

Follow-up Comment #6, bug #50068 (project octave):

I've checked the hypothesis that octave_main does not change internal state of
the process after exit.
According to my understanding based on the following test is doing something.

Reproduction:
1) The following code works well

#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
#include <octave/interpreter.h>

int
main (void)
{
  string_vector argv (2);
  argv(0) = "embedded";
  argv(1) = "-q";

  octave_main (2, argv.c_str_vec (), 1);

  octave_idx_type n = 2;
  octave_value_list in;

  for (octave_idx_type i = 0; i < n; i++)
    in(i) = octave_value (5 * (i + 2));

  octave_value_list out = feval ("gcd", in, 1);

  if (out.length () > 0)
    std::cout << "GCD of ["
              << in(0).int_value ()
              << ", "
              << in(1).int_value ()
              << "] is " << out(0).int_value ()
              << std::endl;
  else
    std::cout << "invalid\n";

  try {
      clean_up_and_exit (0);
  } catch(...) {
  }
}

2) The same code with line

octave_main (2, argv.c_str_vec (), 1);

commented out is crashing.

I don't understand, how above can happen if octave_main only doing the
following:

1) Creates interpreter object
2) Destroys interpreter object


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50068>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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