changeset 30018:09d97b7bc904

avoid possible uninitialized variable warnings * __glpk__.cc (glpk): Initialize time. (F__glpk__): Initialize time and status before call to glpk.
author John W. Eaton <jwe@octave.org>
date Thu, 19 Aug 2021 22:57:36 -0400
parents 26bb2cbf6da2
children 593796903cf4
files libinterp/dldfcn/__glpk__.cc
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__glpk__.cc	Thu Aug 19 17:31:12 2021 -0700
+++ b/libinterp/dldfcn/__glpk__.cc	Thu Aug 19 22:57:36 2021 -0400
@@ -88,6 +88,8 @@
 {
   int typx = 0;
   int errnum = 0;
+
+  *time = 0.0;
   *status = -1;    // Initialize status to "bad" value
 
   clock_t t_start = clock ();
@@ -605,8 +607,9 @@
   double fmin = octave_NA;
   ColumnVector lambda (mrowsA, octave_NA);
   ColumnVector redcosts (mrowsc, octave_NA);
-  double time;
-  int status;
+
+  double time = 0.0;
+  int status = -1;
 
   int errnum = glpk (sense, mrowsc, mrowsA, c, nz, rn.fortran_vec (),
                      cn.fortran_vec (), a.fortran_vec (), b, ctype,