Addressing some uninitialized variables to see if there is an effect on compiler optimizations. Good practice to have these fixed in any event.

This commit is contained in:
Ward Fisher 2021-04-13 11:45:33 -06:00
parent 1e99bb4a7c
commit 802916a914
2 changed files with 19 additions and 20 deletions

View File

@ -98,11 +98,11 @@ define(`TEST_NC_GET_VAR1',dnl
int
TestFunc(var1)_$1(VarArgs)
{
int i, err, ncid, cdf_format;
int i=0, err=0, ncid=0, cdf_format=0;
int nok = 0; /* count of valid comparisons */
int canConvert; /* Both text or both numeric */
IntType j, index[MAX_RANK];
double expect;
int canConvert=0; /* Both text or both numeric */
IntType j=0, index[MAX_RANK];
double expect=0;
$1 value[1];
err = FileOpen(testfile, NC_NOWRITE);
@ -1348,4 +1348,3 @@ TEST_NC_GET_ATT(ushort)
TEST_NC_GET_ATT(uint)
TEST_NC_GET_ATT(longlong)
TEST_NC_GET_ATT(ulonglong)

View File

@ -1031,14 +1031,14 @@ TestFunc(inq_vartype)(VarArgs)
int
TestFunc(get_var1)(VarArgs)
{
int ncid;
int i;
int err;
double expect;
int ncid = 0;
int i = 0;
int err = 0;
double expect = 0;
int nok = 0; /* count of valid comparisons */
double buf[1]; /* (void *) buffer */
double value[1];
IntType j, index[MAX_RANK];
double buf[1] = {0}; /* (void *) buffer */
double value[1] = {0};
IntType j = 0, index[MAX_RANK] = {0};
ifdef(`PNETCDF', `MPI_Datatype datatype;')
err = FileOpen(testfile, NC_NOWRITE, &ncid);
@ -1124,16 +1124,16 @@ ifdef(`PNETCDF',`dnl
int
TestFunc(get_vara)(VarArgs)
{
int ncid, d, i, k, err, nslabs;
int ncid = 0, d = 0, i = 0, k = 0, err = 0, nslabs = 0;
int nok = 0; /* count of valid comparisons */
IntType j, nels;
IntType start[MAX_RANK];
IntType edge[MAX_RANK];
IntType index[MAX_RANK];
IntType mid[MAX_RANK];
IntType j = 0, nels = 0;
IntType start[MAX_RANK]= {0};
IntType edge[MAX_RANK] = {0};
IntType index[MAX_RANK] = {0};
IntType mid[MAX_RANK] = {0};
ifdef(`PNETCDF', `MPI_Datatype datatype;')
double buf[MAX_NELS]; /* (void *) buffer */
double expect;
double buf[MAX_NELS] = {0}; /* (void *) buffer */
double expect = 0;
err = FileOpen(testfile, NC_NOWRITE, &ncid);
IF (err != NC_NOERR)