From 06bbefb5ee32e11aff78d30234a797c609865917 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 23 Jul 2011 20:02:19 +0000 Subject: [PATCH] fix usage of an uninitialized variable --- ChangeLog | 4 ++++ src/spicelib/analysis/cktsens.c | 4 ++++ src/xspice/cm/cmutil.c | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 99f433a43..a857dd780 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-07-23 Robert Larice + * src/xspice/cm/cmutil.c : + fix usage of an uninitialized variable + 2011-07-23 Robert Larice * src/spicelib/analysis/cktsens.c : fix usage of an uninitialized variable diff --git a/src/spicelib/analysis/cktsens.c b/src/spicelib/analysis/cktsens.c index 246cec24e..25ef8d4b4 100644 --- a/src/spicelib/analysis/cktsens.c +++ b/src/spicelib/analysis/cktsens.c @@ -217,6 +217,10 @@ int sens_sens(CKTcircuit *ckt, int restart) } else { /*XXX Restore saved state */ + output_values = NULL; + output_cvalues = NULL; + fprintf(stderr, "ERROR: restore is not implemented for cktsens\n"); + exit(1); } #ifdef ASDEBUG diff --git a/src/xspice/cm/cmutil.c b/src/xspice/cm/cmutil.c index f0cfe8303..61f65b6fd 100755 --- a/src/xspice/cm/cmutil.c +++ b/src/xspice/cm/cmutil.c @@ -385,6 +385,7 @@ double cm_smooth_pwl(double x_input, double *x, double *y, int size, if (x_input <= (*(x+1) + *x)/2.0) {/*** x_input below lowest midpoint ***/ *dout_din = (*(y+1) - *y)/(*(x+1) - *x); out = *y + (x_input - *x) * *dout_din; + return out; } else { if (x_input >= (*(x+size-2) + *(x+size-1))/2.0) { @@ -392,6 +393,7 @@ double cm_smooth_pwl(double x_input, double *x, double *y, int size, *dout_din = (*(y+size-1) - *(y+size-2)) / (*(x+size-1) - *(x+size-2)); out = *(y+size-1) + (x_input - *(x+size-1)) * *dout_din; + return out; } else { /*** x_input within bounds of end midpoints... ***/ /*** must determine position progressively & then ***/ @@ -428,6 +430,7 @@ double cm_smooth_pwl(double x_input, double *x, double *y, int size, if (x_input < threshold_lower) { /* Lower linear region */ *dout_din = (*(y+i) - *(y+i-1))/lower_seg; out = *(y+i) + (x_input - *(x+i)) * *dout_din; + return out; } else { if (x_input < threshold_upper) { /* Parabolic region */ @@ -435,10 +438,12 @@ double cm_smooth_pwl(double x_input, double *x, double *y, int size, upper_slope = (*(y+i+1) - *(y+i))/upper_seg; cm_smooth_corner(x_input,*(x+i),*(y+i),input_domain, lower_slope,upper_slope,&out,dout_din); + return out; } else { /* Upper linear region */ *dout_din = (*(y+i+1) - *(y+i))/upper_seg; out = *(y+i) + (x_input - *(x+i)) * *dout_din; + return out; } } break; /* Break search loop...x_input has been found, */ @@ -447,7 +452,7 @@ double cm_smooth_pwl(double x_input, double *x, double *y, int size, } } } - return out; + return NAN; }