From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#46111: Reverting fns.c hash function due to OpenBSD/SPARC64 compile breaking Date: Thu, 28 Jan 2021 11:17:31 -0500 Message-ID: References: <87sg6oyzi6.wl-me@enzu.ru> <6915951F-2A53-4B08-A48A-6683B99AA14A@gnu.org> <871re5vh7a.fsf@ultra.enzu.ru> <8335ylytpf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36352"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 46111@debbugs.gnu.org To: Ahmed Khanzada Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 28 17:18:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1l59zl-0009JZ-49 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Jan 2021 17:18:09 +0100 Original-Received: from localhost ([::1]:58860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l59zk-0001IF-6R for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Jan 2021 11:18:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l59ze-0001Hz-6w for bug-gnu-emacs@gnu.org; Thu, 28 Jan 2021 11:18:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38083) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l59zd-0002jf-VC for bug-gnu-emacs@gnu.org; Thu, 28 Jan 2021 11:18:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l59zd-0003Og-Qg for bug-gnu-emacs@gnu.org; Thu, 28 Jan 2021 11:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Jan 2021 16:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46111 X-GNU-PR-Package: emacs Original-Received: via spool by 46111-submit@debbugs.gnu.org id=B46111.161185066813038 (code B ref 46111); Thu, 28 Jan 2021 16:18:01 +0000 Original-Received: (at 46111) by debbugs.gnu.org; 28 Jan 2021 16:17:48 +0000 Original-Received: from localhost ([127.0.0.1]:49629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l59zQ-0003OE-Gh for submit@debbugs.gnu.org; Thu, 28 Jan 2021 11:17:48 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:3592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l59zL-0003Nz-RR for 46111@debbugs.gnu.org; Thu, 28 Jan 2021 11:17:47 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id ACCE48079A; Thu, 28 Jan 2021 11:17:38 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0C15680712; Thu, 28 Jan 2021 11:17:33 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1611850653; bh=wko4MXo9PLCefHwARh+6S3NLZW8G9ff+xIg00XjDW9o=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=fu9gFfQO21EzPMY0wUXkxbCsBskSPClI4fjx7a+tzq+7xw/8UsDHGRFf/3vQQs67p DsSAGFbbAzfXktoVj8jnUkoZX4/vjc6gH4QuKImmIwfgWXHRnVlX4VoLMunWkT9fXS tNCtER6zXLyUhVkbzaZlPJIUwX1DHXhe6P4HbN84JRYiBh2RiA86l9J3jTCmrHA8YW fRQyp7PJB9m7ZNms/PuIXnJg9npfNkDslZ8pXe6wlJ31MVeCuIxprOoHuE5xTG+zQQ Zn2sZUnXuuryV/KvIjZzKAYA8a578ETDBARZ/48o/n8MN95tZYv1QgS1sFe2i77lrI yC5seBJatM+Qg== Original-Received: from alfajor (69-196-141-46.dsl.teksavvy.com [69.196.141.46]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D353B12045A; Thu, 28 Jan 2021 11:17:32 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Thu, 28 Jan 2021 10:52:31 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198806 Archived-At: > And the backtrace shows we're hashing the string `DndProtocol` which > comes from `lisp/x-dnd.el` which is indeed preloaded, so I think that's > what's going on. Could you try the patch below? Stefan diff --git a/src/fns.c b/src/fns.c index 7ab2e8f1a0..0c6bb770ef 100644 --- a/src/fns.c +++ b/src/fns.c @@ -4610,7 +4610,20 @@ hash_string (char const *ptr, ptrdiff_t len) * as `p <= end - 1`. */ while (p <= end - 1) { + /* Here `p` is *almost* always be properly aligned, so we want to + optimize for the aligned case, but we still need to support the + non-aligned case. */ + /* FIXME: Could we just always use `memcpy` and rely on GCC optimizing + it to a single word-sized memory access on all-but-sparc64? */ +#ifdef __sparc64__ /* Arch that still insists on aligned memory accesses. */ + EMACS_UINT c; + if (!((unsigned long)p) % sizeof (c)) + c = *p; + else + memcpy (&c, (char const *)p, sizeof (c)); /* `p` is unaligned! */ +#else EMACS_UINT c = *p; +#fi p += step; hash = sxhash_combine (hash, c); }