[Openmp-commits] [openmp] [OpenMP] Remove dead code of checking int > INT_MAX (PR #83305)

Terry Wilmarth via Openmp-commits openmp-commits at lists.llvm.org
Wed Mar 6 11:57:28 PST 2024


================
@@ -4988,9 +4985,6 @@ static void __kmp_stg_parse_adaptive_lock_props(const char *name,
       if (num < 0) { // The number of retries should be >= 0
         msg = KMP_I18N_STR(ValueTooSmall);
         num = 1;
-      } else if (num > KMP_INT_MAX) {
----------------
TerryLWilmarth wrote:

LGTM, but a question.  Why do we still need a KMP_INT_MAX? Can we just use INT_MAX everywhere? Note that __kmp_str_to_int will max out to INT_MAX.  Either we don't need KMP_INT_MAX, or we need to account for the discrepency. We
#define KMP_INT_MAX ((kmp_int32)0x7FFFFFFF).  I assume this was because we wanted it to be a constant that was the same on all architectures.  Is it still needed for anything?    

We now only use it here:
src/kmp_settings.cpp:  __kmp_stg_parse_int(name, value, 0, KMP_INT_MAX, &__kmp_num_locks_in_block);

It looks to me like that could be changed to INT_MAX, and the #define KMP_INT_MAX can be removed.


https://github.com/llvm/llvm-project/pull/83305


More information about the Openmp-commits mailing list