From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: pdumper on Solaris 10 Date: Tue, 17 Dec 2024 22:19:14 +0200 Message-ID: <86pllqm5a5.fsf@gnu.org> References: <8634iwex8q.fsf@gnu.org> <86wmg7bso1.fsf@gnu.org> <865xnrbh3r.fsf@gnu.org> <87bjxil35f.fsf@protonmail.com> <86seqqtjzb.fsf@gnu.org> <87o71ddxmf.fsf@protonmail.com> <86a5cxryfp.fsf@gnu.org> <89cba675-90e6-49d1-b774-f0498de6ac19@cs.ucla.edu> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31727"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pipcet@protonmail.com, gerd.moellmann@gmail.com, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 17 21:21:02 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tNe3x-00086T-VN for ged-emacs-devel@m.gmane-mx.org; Tue, 17 Dec 2024 21:21:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNe2w-0006Mi-6G; Tue, 17 Dec 2024 15:19:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNe2t-0006ML-Kn for emacs-devel@gnu.org; Tue, 17 Dec 2024 15:19:56 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNe2s-0000GT-JD; Tue, 17 Dec 2024 15:19:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1dfHYRQiX3dVR7GcleqvqqwSmZ90rwmrmc2inJMYhNw=; b=eCoBv+p+GTDv BK9uWT/J0K/W5mbsxos/8nykv0QileIrhYF1V6T5q+MxgTN1wnWL0fyKZZDtLIk4j772+78jhEr5v nnh8UqzfMCLL8Wmhmw9Uq1V9hT+V6hyV16mOcFX7kdjeDAP5tGOPFOuRoi8qkO4DsWis8gOYo8PLw jZQUX7KQIXY36LGxuJk/eiUpgSS77svzsJMzlrND1Vy6n750CrtfMZZzjjyiBH2+Ac+2Jr/qE3R5r 6n7CRCtrGzkpTYbysLtB4k4BCra1n7rM1UWYpgQ3tRPo3KCR83psOejyHtETm6c8vcB2awJ1X9zfW 9yQVfQ69XYBDd4CCRa2Tug==; In-Reply-To: <89cba675-90e6-49d1-b774-f0498de6ac19@cs.ucla.edu> (message from Paul Eggert on Tue, 17 Dec 2024 11:10:45 -0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:326615 Archived-At: > Date: Tue, 17 Dec 2024 11:10:45 -0800 > Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org > From: Paul Eggert > > >>> CC igc.o > >>> igc.c: In function 'weak_hash_table_entry': > >>> igc.c:4102:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > >>> 4102 | client = (mps_addr_t)entry.intptr; > >>> | ^ > >>> igc.c:4107:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > >>> 4107 | client = (mps_addr_t)real_ptr; > >>> | ^ > ... > >> What's the preferred way of avoiding a compiler warning in this case? > >> A simple double cast (first to uintptr_t, then to mps_addr_t) should > >> work, right? > > I'll defer to Paul (CC'ed), but my personal preference is also to > > explicitly reset the ignored bits by bitwise AND. > > The usual way I avoid such warnings is a single cast of the pointer to > uintptr_t (or to intptr_t, if the eventual destination is signed). But then why doesn't the cast to mps_addr_t work to avoid the warning? mps_addr_t is 'void *', a 32-bit pointer. Is this something specific to pointers, while casting to a 32-bit integer doesn't trigger the warnings? If so, what is the rationale for warning about pointers, but not about integers?