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

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

[Octave-bug-tracker] [bug #46070] mex function mxIsFromGlobalWS causes a


From: Rik
Subject: [Octave-bug-tracker] [bug #46070] mex function mxIsFromGlobalWS causes abort
Date: Mon, 28 Sep 2015 21:44:55 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0

URL:
  <http://savannah.gnu.org/bugs/?46070>

                 Summary: mex function mxIsFromGlobalWS causes abort
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Mon Sep 28 14:44:54 2015
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Crash
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

This particular mex function is unimplemented in Octave.  The code in mex.cc
is


// Just plain odd thing to ask of a value.
int
mxIsFromGlobalWS (const mxArray */*ptr*/)
{
  // FIXME
  abort ();
  return 0;
}


This seems unnecessarily harsh.  It might be better to issue a warning that
the function is unimplemented and then always return false (0).

Example code to test is attached as mycrash.c.


#include "mex.h"

void
mexFunction (int nlhs, mxArray* plhs[],
             int nrhs, const mxArray* prhs[])
{
  char *str;
  mxArray *v;
  int found = 0;

  if (nrhs != 1 || ! mxIsChar (prhs[0]))
    mexErrMsgTxt ("Argument must be a symbol name");

  str = mxArrayToString (prhs[0]);

  v = mexGetArray (str, "global");
  if (v && mxIsFromGlobalWS (v))
    {
      mexPrintf ("%s is a global variable with the following value:\n", str);
      mexCallMATLAB (0, NULL, 1, &v, "disp");
    }
}


A sample session within Octave is shown below


octave:1> mex mycrash.c
octave:2> global a
octave:3> a = 1
a =  1
octave:4> mycrash ('a')
panic: Aborted -- stopping myself...
attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete
Abort






    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon Sep 28 14:44:54 2015  Name: mycrash.c  Size: 493B   By: rik5

<http://savannah.gnu.org/bugs/download.php?file_id=35007>

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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