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

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

[Octave-bug-tracker] [bug #53330] [octave forge] (control) several funct


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #53330] [octave forge] (control) several functions crash Octave with SIGABRT from invalid free
Date: Tue, 13 Mar 2018 14:21:50 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0

Follow-up Comment #4, bug #53330 (project octave):

The integers are not the problem. I see that jwe went though last year and
fixed all of the integer references in the control package.

I think the remaining problem is the Fortran LOGICAL arrays called BWORK.

When I make the following changes to two of the SLICOT wrapper functions, the
tests for h2syn now pass without crashing Octave.


diff --git a/src/sl_sb10ed.cc b/src/sl_sb10ed.cc
--- a/src/sl_sb10ed.cc
+++ b/src/sl_sb10ed.cc
@@ -47,7 +47,7 @@ extern "C"
                   double& TOL,
                   F77_INT* IWORK,
                   double* DWORK, F77_INT& LDWORK,
-                  bool* BWORK,
+                  F77_LOGICAL* BWORK,
                   F77_INT& INFO);
 }
 
@@ -113,7 +113,7 @@ For internal use only.")
         
         OCTAVE_LOCAL_BUFFER (F77_INT, iwork, liwork);
         OCTAVE_LOCAL_BUFFER (double, dwork, ldwork);
-        OCTAVE_LOCAL_BUFFER (bool, bwork, 2*n);
+        OCTAVE_LOCAL_BUFFER (F77_LOGICAL, bwork, 2*n);
         
         // error indicator
         F77_INT info;
diff --git a/src/sl_sb10hd.cc b/src/sl_sb10hd.cc
--- a/src/sl_sb10hd.cc
+++ b/src/sl_sb10hd.cc
@@ -47,7 +47,7 @@ extern "C"
                   double& TOL,
                   F77_INT* IWORK,
                   double* DWORK, F77_INT& LDWORK,
-                  bool* BWORK,
+                  F77_LOGICAL* BWORK,
                   F77_INT& INFO);
 }
 
@@ -110,7 +110,7 @@ For internal use only.")
         
         OCTAVE_LOCAL_BUFFER (F77_INT, iwork, max (2*n, n*n));
         OCTAVE_LOCAL_BUFFER (double, dwork, ldwork);
-        OCTAVE_LOCAL_BUFFER (bool, bwork, 2*n);
+        OCTAVE_LOCAL_BUFFER (F77_LOGICAL, bwork, 2*n);
         
         // error indicator
         F77_INT info;


I think there must be some optimization going on with the case of a C++ bool
and the changes that were made to the OCTAVE_LOCAL_BUFFER macro. You must use
the F77_LOGICAL type now for any Fortran LOGICAL arguments, return values, or
in this case, scratch arrays, that are passed in to a Fortran routine.

Make that change to all of the SLICOT C++ wrapper routines and you should be
ok.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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