Skip to content

Commit 0e61de1

Browse files
committed
coll xhc: ensure to initialize member_id
In reality, it's extremely unlikely (or possibly impossible?) for member_id to get through the loop without being assigned. But gcc 14's static analyzer flags it as possible and emits a warning. So initially assign it to -1 and put in an assert() to catch (in debug builds) if it isn't assigned. Signed-off-by: Jeff Squyres <[email protected]>
1 parent c133d17 commit 0e61de1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ompi/mca/coll/xhc/coll_xhc_module.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright (c) 2021-2023 Computer Architecture and VLSI Systems (CARV)
33
* Laboratory, ICS Forth. All rights reserved.
4+
* Copyright (c) 2024 Jeffrey M. Squyres. All rights reserved.
45
* $COPYRIGHT$
56
*
67
* Additional copyrights may follow
@@ -523,7 +524,7 @@ static int xhc_module_create_hierarchy(xhc_module_t *module,
523524
continue;
524525
}
525526

526-
int member_id;
527+
int member_id = -1;
527528
int members = 0;
528529

529530
// If working with rank list, set the ranks from the list as "local"
@@ -560,6 +561,8 @@ static int xhc_module_create_hierarchy(xhc_module_t *module,
560561
}
561562
}
562563

564+
assert(member_id != -1);
565+
563566
/* If split or max ranks was specified, math partition the locality
564567
* and remove the previously added locality mapping to some ranks */
565568
if(my_def->split > 1) {

0 commit comments

Comments
 (0)