Skip to content

Commit 093d059

Browse files
committed
nvc compile warning: transfer of control bypasses initialization of: [branch_past_initialization]
1 parent a1b4aad commit 093d059

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

src/drivers/common/dtype_decode.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,11 @@ int ncmpii_dtype_decode(MPI_Datatype dtype,
300300
MPI_Aint *array_of_adds=NULL;
301301
#ifdef HAVE_MPI_LARGE_COUNT
302302
MPI_Count num_ints, num_adds, num_larges, num_dtypes, *array_of_larges;
303+
int *distribs, *dargs, *psizes;
304+
MPI_Count *gzises;
303305
#else
304306
int num_ints, num_adds, num_dtypes;
307+
int *gzises, *distribs, *dargs, *psizes;
305308
#endif
306309

307310
el_size = 0;
@@ -553,8 +556,6 @@ int ncmpii_dtype_decode(MPI_Datatype dtype,
553556
if (iscontig_of_ptypes) *iscontig_of_ptypes = 0;
554557
ndims = array_of_ints[2];
555558
#ifdef HAVE_MPI_LARGE_COUNT
556-
int *distribs, *dargs, *psizes;
557-
MPI_Count *gzises;
558559
if (is_large_type) {
559560
gzises = array_of_larges;
560561
distribs = array_of_ints+3; /* array_of_distribs[ndims] */
@@ -569,10 +570,10 @@ int ncmpii_dtype_decode(MPI_Datatype dtype,
569570
psizes = array_of_ints+3+3*ndims; /* array_of_psizes[ndims] */
570571
}
571572
#else
572-
int *gzises = array_of_ints+3; /* array_of_gsizes[ndims] */
573-
int *distribs = array_of_ints+3+ndims; /* array_of_distribs[ndims] */
574-
int *dargs = array_of_ints+3+2*ndims; /* array_of_dargs[ndims] */
575-
int *psizes = array_of_ints+3+3*ndims; /* array_of_psizes[ndims] */
573+
gzises = array_of_ints+3; /* array_of_gsizes[ndims] */
574+
distribs = array_of_ints+3+ndims; /* array_of_distribs[ndims] */
575+
dargs = array_of_ints+3+2*ndims; /* array_of_dargs[ndims] */
576+
psizes = array_of_ints+3+3*ndims; /* array_of_psizes[ndims] */
576577
#endif
577578
/* seldom reached, so put it in a separate function */
578579
total_blocks = darray_get_totalblks(array_of_ints[1], /* rank */

src/drivers/ncmpio/ncmpio_vard.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ getput_vard(NC *ncp,
6060
MPI_Offset nelems=0, fnelems=0, bnelems=0, offset=0;
6161
MPI_Datatype etype=MPI_DATATYPE_NULL, xtype=MPI_BYTE;
6262
MPI_Offset filetype_size;
63+
#ifdef HAVE_MPI_TYPE_SIZE_C
64+
MPI_Count true_lb=0, true_ub=0, true_extent=0;
65+
MPI_Count type_size;
66+
#elif defined(HAVE_MPI_TYPE_SIZE_X)
67+
MPI_Count true_lb=0, true_ub=0, true_extent=0;
68+
MPI_Count type_size;
69+
#else
70+
MPI_Aint true_lb=0, true_ub=0, true_extent=0;
71+
int type_size;
72+
#endif
6373

6474
#ifdef ENABLE_SUBFILING
6575
/* call a separate routine if variable is stored in subfiles */
@@ -86,24 +96,15 @@ getput_vard(NC *ncp,
8696
*/
8797
#ifdef HAVE_MPI_TYPE_SIZE_C
8898
/* MPI_Type_size_c is introduced in MPI 4.0 */
89-
MPI_Count true_lb=0, true_ub=0, true_extent=0;
90-
MPI_Count type_size;
91-
9299
mpireturn = MPI_Type_size_c(filetype, &type_size);
93100
#elif defined(HAVE_MPI_TYPE_SIZE_X)
94101
/* MPI_Type_size_x is introduced in MPI 3.0 */
95-
MPI_Count true_lb=0, true_ub=0, true_extent=0;
96-
MPI_Count type_size;
97-
98102
mpireturn = MPI_Type_size_x(filetype, &type_size);
99103
#else
100104
/* PROBLEM: In MPI_Type_size(), argument filetype_size is a 4-byte integer,
101105
* cannot be used for large filetypes. Prior to MPI 3.0 standard, argument
102106
* "size" of MPI_Type_size is of type int. When int overflows, the returned
103107
* value in argument "size" may be a negative. */
104-
MPI_Aint true_lb=0, true_ub=0, true_extent=0;
105-
int type_size;
106-
107108
mpireturn = MPI_Type_size(filetype, &type_size);
108109
#endif
109110
if (mpireturn != MPI_SUCCESS) {

0 commit comments

Comments
 (0)