Skip to content

Commit

Permalink
Merge pull request #134 from jschueller/uninitialized
Browse files Browse the repository at this point in the history
Fix all uninitialized variable warnings
  • Loading branch information
jschueller authored Aug 24, 2017
2 parents f4157d9 + 5b068e9 commit c43afa0
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 41 deletions.
34 changes: 17 additions & 17 deletions bobyqa/bobyqa.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ static nlopt_result rescue_(int *n, int *npt, const double *xl, const double *xu
/* Local variables */
double f;
int i__, j, k, ih, jp, ip, iq, np, iw;
double xp, xq, den;
int ihp;
double xp = 0.0, xq, den;
int ihp = 0;
double one;
int ihq, jpn, kpt;
double sum, diff, half, beta;
Expand Down Expand Up @@ -760,12 +760,12 @@ static void altmov_(int *n, int *npt, double *xpt,
double slbd;
int iubd;
double vlag, subd, temp;
int ksav;
double step, zero, curv;
int ksav = 0;
double step = 0.0, zero, curv;
int iflag;
double scale, csave, tempa, tempb, tempd, const__, sumin, ggfree;
int ibdsav;
double dderiv, bigstp, predsq, presav, distsq, stpsav, wfixsq, wsqsav;
double scale, csave = 0.0, tempa, tempb, tempd, const__, sumin, ggfree;
int ibdsav = 0;
double dderiv, bigstp, predsq, presav, distsq, stpsav = 0.0, wfixsq, wsqsav;


/* The arguments N, NPT, XPT, XOPT, BMAT, ZMAT, NDIM, SL and SU all have */
Expand Down Expand Up @@ -1174,16 +1174,16 @@ static void trsbox_(int *n, int *npt, double *xpt,
double ds;
int iu;
double dhd, dhs, cth, one, shs, sth, ssq, half, beta, sdec, blen;
int iact, nact;
int iact = 0, nact;
double angt, qred;
int isav;
double temp, zero, xsav, xsum, angbd, dredg, sredg;
double temp, zero, xsav = 0.0, xsum, angbd = 0.0, dredg = 0.0, sredg = 0.0;
int iterc;
double resid, delsq, ggsav, tempa, tempb, ratio, sqstp, redmax,
dredsq, redsav, onemin, gredsq, rednew;
int itcsav;
double rdprev, rdnext, stplen, stepsq;
int itermax;
double resid, delsq, ggsav = 0.0, tempa, tempb, ratio, sqstp, redmax,
dredsq = 0.0, redsav, onemin, gredsq = 0.0, rednew;
int itcsav = 0;
double rdprev, rdnext = 0.0, stplen, stepsq;
int itermax = 0;


/* The arguments N, NPT, XPT, XOPT, GOPT, HQ, PQ, SL and SU have the same */
Expand Down Expand Up @@ -1728,8 +1728,8 @@ static nlopt_result prelim_(int *n, int *npt, double *x,
double f;
int i__, j, k, ih, np, nfm;
double one;
int nfx, ipt, jpt;
double two, fbeg, diff, half, temp, zero, recip, stepa, stepb;
int nfx, ipt = 0, jpt = 0;
double two, fbeg, diff, half, temp, zero, recip, stepa = 0.0, stepb = 0.0;
int itemp;
double rhosq;

Expand Down Expand Up @@ -1979,7 +1979,7 @@ static nlopt_result bobyqb_(int *n, int *npt, double *x,
int kopt, nptm;
double zero, curv;
int ksav;
double gqsq, dist, sumw, sumz, diffa, diffb, diffc, hdiag;
double gqsq, dist, sumw, sumz, diffa, diffb, diffc = 0.0, hdiag;
int kbase;
double alpha, delta, adelt, denom, fsave, bdtol, delsq;
int nresc, nfsav;
Expand Down
2 changes: 1 addition & 1 deletion cobyla/cobyla.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ static nlopt_result cobylb(int *n, int *m, int *mpp,
int ivmc;
int ivmd;
int mp, np, iz, ibrnch;
int nbest, ifull, iptem, jdrop;
int nbest, ifull = 0, iptem, jdrop;
nlopt_result rc = NLOPT_SUCCESS;
uint32_t seed = (uint32_t) (*n + *m); /* arbitrary deterministic LCG seed */
int feasible;
Expand Down
2 changes: 1 addition & 1 deletion luksan/pnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static void pnet_(int *nf, int *nb, double *x, int *
/* Builtin functions */

/* Local variables */
double a, b;
double a = 0.0, b = 0.0;
int i__, n;
double p, r__;
int kd, ld;
Expand Down
2 changes: 1 addition & 1 deletion luksan/pssubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void luksan_pnint1__(double *rl, double *ru, double *fl,
double d__1, d__2;

/* Local variables */
double a, b, c__, d__, den, dis;
double a = 0.0, b = 0.0, c__, d__, den = 0.0, dis;
int ntyp;

*merr = 0;
Expand Down
2 changes: 1 addition & 1 deletion mma/ccsa_quadratic.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ nlopt_result ccsa_quadratic_minimize(
double *xcur, rho, *sigma, *dfdx, *dfdx_cur, *xprev, *xprevprev, fcur;
double *dfcdx, *dfcdx_cur;
double *fcval, *fcval_cur, *rhoc, *gcval, *y, *dual_lb, *dual_ub;
double *pre_lb, *pre_ub;
double *pre_lb = NULL, *pre_ub = NULL;
unsigned i, ifc, j, k = 0;
dual_data dd;
int feasible;
Expand Down
36 changes: 18 additions & 18 deletions newuoa/newuoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ static nlopt_result trsapp_(int *n, int *npt, double *xopt,

/* Local variables */
int i__, j, k;
double dd, cf, dg, gg;
double dd = 0.0, cf, dg, gg = 0.0;
int ih;
double ds, sg;
double ds, sg = 0.0;
int iu;
double ss, dhd, dhs, cth, sgk, shs, sth, qadd, half, qbeg, qred, qmin,
temp, qsav, qnew, zero, ggbeg, alpha, angle, reduc;
double ss, dhd, dhs, cth, sgk, shs = 0.0, sth, qadd, half, qbeg, qred = 0.0, qmin,
temp, qsav, qnew, zero, ggbeg = 0.0, alpha, angle, reduc;
int iterc;
double ggsav, delsq, tempa, tempb;
double ggsav, delsq, tempa = 0.0, tempb = 0.0;
int isave;
double bstep, ratio, twopi;
double bstep = 0.0, ratio, twopi;
int itersw;
double angtest;
int itermax;
Expand Down Expand Up @@ -1070,7 +1070,7 @@ static nlopt_result biglag_(int *n, int *npt, double *xopt,
int nptm;
double zero, angle, scale, denom;
int iterc, isave;
double delsq, tempa, tempb, twopi, taubeg, tauold, taumax;
double delsq, tempa, tempb = 0.0, twopi, taubeg, tauold, taumax;


/* N is the number of variables. */
Expand Down Expand Up @@ -1390,7 +1390,7 @@ static void update_(int *n, int *npt, double *bmat,
int nptm;
double zero;
int iflag;
double scala, scalb_, alpha, denom, tempa, tempb, tausq;
double scala, scalb_, alpha, denom, tempa, tempb = 0.0, tausq;


/* The arrays BMAT and ZMAT with IDZ are updated, in order to shift the */
Expand Down Expand Up @@ -1579,31 +1579,31 @@ static nlopt_result newuob_(int *n, int *npt, double *x,
double d__1, d__2, d__3;

/* Local variables */
double f;
double f = 0.0;
int i__, j, k, ih, nf, nh, ip, jp;
double dx;
int np, nfm;
double one;
int idz;
double dsq, rho;
int ipt, jpt;
double sum, fbeg, diff, half, beta;
double dsq, rho = 0.0;
int ipt = 0, jpt = 0;
double sum, fbeg = 0.0, diff, half, beta;
int nfmm;
double gisq;
int knew;
double temp, suma, sumb, fopt = HUGE_VAL, bsum, gqsq;
int kopt, nptm;
double zero, xipt, xjpt, sumz, diffa, diffb, diffc, hdiag, alpha,
double zero, xipt = 0.0, xjpt = 0.0, sumz, diffa = 0.0, diffb = 0.0, diffc = 0.0, hdiag, alpha = 0.0,
delta, recip, reciq, fsave;
int ksave, nfsav, itemp;
double dnorm, ratio, dstep, tenth, vquad;
int ksave, nfsav = 0, itemp;
double dnorm = 0.0, ratio = 0.0, dstep, tenth, vquad;
int ktemp;
double tempq;
int itest;
int itest = 0;
double rhosq;
double detrat, crvmin;
double detrat, crvmin = 0.0;
double distsq;
double xoptsq;
double xoptsq = 0.0;
double rhoend;
nlopt_result rc = NLOPT_SUCCESS, rc2;

Expand Down
2 changes: 1 addition & 1 deletion praxis/praxis.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ static void minfit_(int m, int n, double machep,

/* Local variables */
double *e; /* size n */
double c__, f, g, h__;
double c__, f = 0.0, g, h__;
int i__, j, k, l;
double s, x, y, z__;
int l2, ii, kk, kt, ll2, lp1;
Expand Down
2 changes: 1 addition & 1 deletion slsqp/slsqp.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static void nnls_(double *a, int *mda, int *m, int *
double up;
int iz1, iz2, npp1, iter;
double wmax, alpha, asave;
int itmax, izmax, nsetp;
int itmax, izmax = 0, nsetp;
double unorm;

/* C.L.LAWSON AND R.J.HANSON, JET PROPULSION LABORATORY: */
Expand Down

0 comments on commit c43afa0

Please sign in to comment.