Skip to content

Commit 0671e45

Browse files
committed
op: Add a default value for MPI_OP o_name
1 parent f38cc00 commit 0671e45

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ompi/op/op.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ ompi_op_t *ompi_op_create_user(bool commute,
356356
new_op->o_flags |= OMPI_OP_FLAGS_COMMUTE;
357357
}
358358

359+
strncpy(new_op->o_name, "USER OP", sizeof(new_op->o_name) - 1);
360+
new_op->o_name[sizeof(new_op->o_name) - 1] = '\0';
361+
359362
/* Set the user-defined callback function. The "fort_fn" member
360363
is part of a union, so it doesn't matter if this is a C or
361364
Fortan callback; we'll call the right flavor (per o_flags) at
@@ -446,6 +449,7 @@ static void ompi_op_construct(ompi_op_t *new_op)
446449
/* Provide a default of a high value. Useful for non-predefined ops. */
447450
new_op->op_type = OMPI_OP_NUM_OF_TYPES;
448451
new_op->o_flags = 0;
452+
new_op->o_name[0] = '\0';
449453

450454
/* assign entry in fortran <-> c translation array */
451455

0 commit comments

Comments
 (0)