]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: Fix up build on mingw [PR107641]
authorJakub Jelinek <jakub@redhat.com>
Mon, 14 Nov 2022 08:15:08 +0000 (09:15 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Mon, 14 Nov 2022 08:15:08 +0000 (09:15 +0100)
Pointers should be first casted to intptr_t/uintptr_t before casting
them to another integral type to avoid warnings.
Furthermore, the function has code like
  else if (upper <= UINT_MAX)
    something;
  else
    something_else;
so it seems using unsigned type for upper where upper <= UINT_MAX is always
true is not intended.

2022-11-12  Jakub Jelinek  <jakub@redhat.com>

PR libgomp/107641
* env.c (parse_unsigned_long): Cast params[2] to uintptr_t rather than
unsigned long.  Change type of upper from unsigned to unsigned long.

(cherry picked from commit 2a193e9df82917eaf440a20f99a3febe91dcb5fe)

libgomp/ChangeLog.omp
libgomp/env.c

index 95d5186606c9d3afb7266efd9d1353d1530bf7d3..7e117fd50101e753e97329c04b76e48b598a3692 100644 (file)
@@ -1,3 +1,12 @@
+2022-11-14  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backport from mainline:
+       2022-11-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR libgomp/107641
+       * env.c (parse_unsigned_long): Cast params[2] to uintptr_t rather than
+       unsigned long.  Change type of upper from unsigned to unsigned long.
+
 2022-11-04  Tobias Burnus  <tobias@codesourcery.com>
 
        * testsuite/libgomp.fortran/target-13.f90: Remove strides to match
index 0249966e8a6fbe09ce1631eba7c2ecc1e8fb210b..279937bb36cbf50fc3b9e7c6f088f7d940d3065f 100644 (file)
@@ -283,7 +283,7 @@ parse_unsigned_long_1 (const char *env, const char *val, unsigned long *pvalue,
 static bool
 parse_unsigned_long (const char *env, const char *val, void *const params[])
 {
-  unsigned upper = (unsigned long) params[2];
+  unsigned long upper = (uintptr_t) params[2];
   unsigned long pvalue = 0;
   bool ret = parse_unsigned_long_1 (env, val, &pvalue, (bool) params[1]);
   if (!ret)