From patchwork Wed Dec 13 20:17:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 178292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8056167dys; Wed, 13 Dec 2023 12:18:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnxZ4TQoaDyQ4i1D0porbS2vvLmulJG9O7XRXVIdxA4Q5kvn3P6triFsF93LpT5W3SjHQ7 X-Received: by 2002:a05:6808:bce:b0:3ba:845:93d5 with SMTP id o14-20020a0568080bce00b003ba084593d5mr7720663oik.79.1702498687438; Wed, 13 Dec 2023 12:18:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702498687; cv=pass; d=google.com; s=arc-20160816; b=dUDoB9azinXG2/QpHsJoh7hJK8FrRlGiy/mOOnoCxSoTTckxw42iFg0TYtm+p2B9qC CdR2AzGcNWfdyAC9TpqgdAowCEwUpiaC+lYWSTKh4pk3KLN4mDh3+K5KGTpkn8YLEE6m mmTC5k2DFqyIS+SqoJtHlDrX5a0O1yf7iqsEHT8SmNsNeVrfRt0clVP5mYLz+kkYw7TW sm8G/UcWg4HmgrSnTNlH/KB333Q2aRhsv5kudJObES9bWcc95LCTYli5C9xjNVfu1jHc AcsQZ/iLVyhdn34rG+Ecm4dIOoXnOGhvueukF6Bd7FjnY6dKhkHkbyd4K6ANcJYR4Lh7 CN2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=S6HbyNziJ/lmyer8arzJSro0qvzlwVXYUUl3WfOiMpU=; fh=g1B9zNQxgdfBoEGgl1KZhjqTEVKzJK/oXFDZrThPqQY=; b=faF+2K1/z40N3q3NJrfMyeY+VSIdoq2FXT4sdE2vuXAR0eIfS/bhetIDBvk9nUk/ob t9cqtx8bGP+7nGJPrtGc28HWd8B9x0VmchW+vKHlh4qtMZUoXIel7rwkwj8Xek3Wf47M tHeGHSuV6+m2OlrX50z7gA1dJI/QndCBDJac8IKeZCxYAoLja00Fm/n+m4tX2kCRagFy W/D1rzt7OF9xkqS5pUbaRQh3lNzKQ4x11HTZFpHG0tYVWaSqkw/FNqwgk6RyLlZ99TM+ 2QVd1SvW07MFjxS6hUctRULhZmQYdHViyQCGQaYAaHAGoOxE4u0Ul6mGMqnl2Qjw3ccw FZLg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id r19-20020a67f453000000b0046481733df6si2586210vsn.4.2023.12.13.12.18.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 12:18:07 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 293D1385E010 for ; Wed, 13 Dec 2023 20:18:06 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785199263267928984 X-GMAIL-MSGID: 1785199263267928984 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 mismatch", see attached. Grüße Thomas >> In file included from ../../../../trunk/libgomp/config/linux/allocator.c:31: >> ../../../../trunk/libgomp/config/linux/allocator.c: In function >> ‘linux_memspace_alloc’: >> ../../../../trunk/libgomp/config/linux/allocator.c:70:26: error: format >> ‘%ld’ expects argument of type ‘long int’, but argument 3 has type >> ‘size_t’ {aka ‘unsigned int’} [-Werror=format=] >> 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 >> ‘gomp_debug’ >> 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ße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 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=UTF-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 ‘linux_memspace_alloc’: [...]/source-gcc/libgomp/config/linux/allocator.c:70:26: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=] 70 | gomp_debug (0, "libgomp: failed to pin %ld bytes of" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 71 | " memory (ulimit too low?)\n", size); | ~~~~ | | | size_t {aka unsigned int} [...]/source-gcc/libgomp/libgomp.h:186:29: note: in definition of macro ‘gomp_debug’ 186 | (gomp_debug) ((KIND), __VA_ARGS__); \ | ^~~~~~~~~~~ [...]/source-gcc/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 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/libgomp' [...] 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/allocator.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 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, size_t size, int pin) 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; } -- 2.34.1