Skip to content

Commit a5baf9e

Browse files
committed
[OpenMP][NFC] Fix -Wsign-compare warning in kmp_collapse.cpp
Fix a signed/unsigned comparison warning in `kmp_collapse.cpp`. `inner_ub0_u64` is of type `kmp_uint64`, but was being compared against `-1`, a signed integer literal, triggering a `-Wsign-compare` warning. This patch explicitly casts `-1` to `(kmp_uint64)-1` to avoid the warning and ensure correct comparison behavior.
1 parent 6738cfe commit a5baf9e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

openmp/runtime/src/kmp_collapse.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,8 @@ kmp_identify_nested_loop_structure(/*in*/ bounds_info_t *original_bounds_nest,
13141314
original_bounds_nest[1].ub1_u64);
13151315
// lower triangle loop inner bounds need to be {0,0}:{0/-1,1}
13161316
if (inner_lb0_u64 == 0 && inner_lb1_u64 == 0 &&
1317-
(inner_ub0_u64 == 0 || inner_ub0_u64 == -1) && inner_ub1_u64 == 1) {
1317+
(inner_ub0_u64 == 0 || inner_ub0_u64 == (kmp_uint64)-1) &&
1318+
inner_ub1_u64 == 1) {
13181319
return nested_loop_type_lower_triangular_matrix;
13191320
}
13201321
// upper triangle loop inner bounds need to be {0,1}:{N,0}

0 commit comments

Comments
 (0)