public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libgomp: Fix up build on mingw [PR107641]
@ 2022-11-12  8:51 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-11-12  8:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: Marcel Vollweiler

Hi!

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.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

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.

--- libgomp/env.c.jj	2022-09-13 18:59:52.331054977 +0200
+++ libgomp/env.c	2022-11-11 18:10:21.552415182 +0100
@@ -283,7 +283,7 @@ parse_unsigned_long_1 (const char *env,
 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)

	Jakub


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-12  8:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-12  8:51 [committed] libgomp: Fix up build on mingw [PR107641] Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).