From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 43B493858C78; Wed, 13 Dec 2023 20:17:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 43B493858C78 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 43B493858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.141.98 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702498664; cv=none; b=YXvI14a+ldSHueTTmtOtJXH7bgZaLyj/f3tnPYKbqzt0gv0kZv4vmKgTV1zS4rHvDjtSGfHmUBH9cCgEI1AcxweyGmg7vd+9gHS0krGf56lv7d9Njji7cHWx7NKBZvM73QxA9fB6p6Ap7R/HMSt3O9LrEwQzRsrSrIIQ16bo8Zs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702498664; c=relaxed/simple; bh=YkNqRDv5ywUTx6NmIa6dRXE3/1sXe2okGBtZ6qSDlOM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=yE2XII+VavqB6vZCxJ9YxxGCY8xzyPlOeWuvrdHLCi9SXmPVxIuFoG94JAJXH5YfcVRVvT8U1yfxixhdYbv7yvxZgiHmnrLa//y9M5+3T7jeczEC2jAkPSNav5Y0sCEWVXq3ym+99qWksqpp7rALbkx+fxxTbhpnH0oHd9egLeM= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: TK4oepyYR0ydukAKYRsGRg== X-CSE-MsgGUID: 8gezGfAdSMqnqdaJi6IsNA== X-IronPort-AV: E=Sophos;i="6.04,273,1695715200"; d="scan'208,223";a="28197484" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 13 Dec 2023 12:17:40 -0800 IronPort-SDR: skmLT+TolRC7dGO50Hd5yjFVRcyJAJfP7cjIXv1WU8+2Ev4rS5PKJP9qVIlNRvb+760p7dPR7X i4f0qj3bZxqFWoY3HFnRZ0V31WaAq815QCMIwbn0/YPXHQslRC5lfnCZ8Gj9Q+NBFsVm7Uipqi p2H8bHq11Khi7kStm+GI6G8w/3U3pi+wzjZC/cXFA7Y9XF2hgaisd3A626k8PcvD0BI60suXfX /7NbYQCoAE8mdFwrdHCCECVqwI2bOQ+nM16HgpUEWmN+UJA4T6fHBivUNiFcSnsZlWDIeVGd+N umU= From: Thomas Schwinge To: Jerry D , Andrew Stubbs , CC: Tobias Burnus , Jakub Jelinek , , Subject: Fix 'libgomp/config/linux/allocator.c' 'size_t' vs. '%ld' format string mismatch (was: Build breakage) In-Reply-To: <87cyv999o7.fsf@euler.schwinge.homeip.net> References: <9ffed162-2197-4acd-b72c-1946dc899f86@gmail.com> <87cyv999o7.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 13 Dec 2023 21:17:33 +0100 Message-ID: <87a5qd97s2.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! On 2023-12-13T20:36:40+0100, I wrote: > On 2023-12-13T11:15:54-0800, Jerry D via Gcc wrote: >> I am getting this failure to build from clean trunk. > > This is due to commit r14-6499-g348874f0baac0f22c98ab11abbfa65fd172f6bdd > "libgomp: basic pinned memory on Linux", which supposedly was only tested > with '--disable-multilib' or so. As Andrew's now on vacations -- > conveniently ;-P -- I'll soon push a fix. Pushed to master branch commit 5445ff4a51fcee4d281f79b5f54b349290d0327d "Fix 'libgomp/config/linux/allocator.c' 'size_t' vs. '%ld' format string mi= smatch", see attached. Gr=C3=BC=C3=9Fe Thomas >> In file included from ../../../../trunk/libgomp/config/linux/allocator.c= :31: >> ../../../../trunk/libgomp/config/linux/allocator.c: In function >> =E2=80=98linux_memspace_alloc=E2=80=99: >> ../../../../trunk/libgomp/config/linux/allocator.c:70:26: error: format >> =E2=80=98%ld=E2=80=99 expects argument of type =E2=80=98long int=E2=80= =99, but argument 3 has type >> =E2=80=98size_t=E2=80=99 {aka =E2=80=98unsigned int=E2=80=99} [-Werror= =3Dformat=3D] >> 70 | gomp_debug (0, "libgomp: failed to pin %ld bytes of" >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> 71 | " memory (ulimit too low?)\n", size); >> | ~~~~ >> | | >> | size_t >> {aka unsigned int} >> ../../../../trunk/libgomp/libgomp.h:186:29: note: in definition of macro >> =E2=80=98gomp_debug=E2=80=99 >> 186 | (gomp_debug) ((KIND), __VA_ARGS__); \ >> | ^~~~~~~~~~~ >> ../../../../trunk/libgomp/config/linux/allocator.c:70:52: note: format >> string is defined here >> 70 | gomp_debug (0, "libgomp: failed to pin %ld bytes of" >> | ~~^ >> | | >> | long int >> | %d ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955 --=-=-= Content-Type: text/x-diff; charset="utf-8" Content-Disposition: inline; filename="0001-Fix-libgomp-config-linux-allocator.c-size_t-vs.-ld-f.patch" Content-Transfer-Encoding: quoted-printable >From 5445ff4a51fcee4d281f79b5f54b349290d0327d Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 13 Dec 2023 17:48:11 +0100 Subject: [PATCH] Fix 'libgomp/config/linux/allocator.c' 'size_t' vs. '%ld' format string mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Fix-up for commit 348874f0baac0f22c98ab11abbfa65fd172f6bdd "libgomp: basic pinned memory on Linux", which may result in build failures as follow, for example, for the '-m32' multilib of x86_64-pc-linux-gnu: In file included from [...]/source-gcc/libgomp/config/linux/allocator.c= :31: [...]/source-gcc/libgomp/config/linux/allocator.c: In function =E2=80= =98linux_memspace_alloc=E2=80=99: [...]/source-gcc/libgomp/config/linux/allocator.c:70:26: error: format = =E2=80=98%ld=E2=80=99 expects argument of type =E2=80=98long int=E2=80=99, = but argument 3 has type =E2=80=98size_t=E2=80=99 {aka =E2=80=98unsigned int= =E2=80=99} [-Werror=3Dformat=3D] 70 | gomp_debug (0, "libgomp: failed to pin %ld bytes of" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 71 | " memory (ulimit too low?)\n", size); | ~~~~ | | | size_t {ak= a unsigned int} [...]/source-gcc/libgomp/libgomp.h:186:29: note: in definition of macro= =E2=80=98gomp_debug=E2=80=99 186 | (gomp_debug) ((KIND), __VA_ARGS__); \ | ^~~~~~~~~~~ [...]/source-gcc/libgomp/config/linux/allocator.c:70:52: note: format s= tring is defined here 70 | gomp_debug (0, "libgomp: failed to pin %ld bytes of" | ~~^ | | | long int | %d cc1: all warnings being treated as errors make[9]: *** [allocator.lo] Error 1 make[9]: Leaving directory `[...]/build-gcc/x86_64-pc-linux-gnu/32/libg= omp' [...] Fix this in the same way as used elsewhere in libgomp. libgomp/ * config/linux/allocator.c (linux_memspace_alloc): Fix 'size_t' vs. '%ld' format string mismatch. --- libgomp/config/linux/allocator.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libgomp/config/linux/allocator.c b/libgomp/config/linux/alloca= tor.c index 269d0d607d8..6ffa2417913 100644 --- a/libgomp/config/linux/allocator.c +++ b/libgomp/config/linux/allocator.c @@ -50,6 +50,9 @@ #include #include #include "libgomp.h" +#ifdef HAVE_INTTYPES_H +# include /* For PRIu64. */ +#endif =20 static void * linux_memspace_alloc (omp_memspace_handle_t memspace, size_t size, int pin) @@ -67,8 +70,13 @@ linux_memspace_alloc (omp_memspace_handle_t memspace, si= ze_t size, int pin) =20 if (mlock (addr, size)) { - gomp_debug (0, "libgomp: failed to pin %ld bytes of" - " memory (ulimit too low?)\n", size); +#ifdef HAVE_INTTYPES_H + gomp_debug (0, "libgomp: failed to pin %"PRIu64" bytes of" + " memory (ulimit too low?)\n", (uint64_t) size); +#else + gomp_debug (0, "libgomp: failed to pin %lu bytes of" + " memory (ulimit too low?)\n", (unsigned long) size); +#endif munmap (addr, size); return NULL; } --=20 2.34.1 --=-=-=--