Subject: bug#46111: Reverting fns.c hash function due to OpenBSD/SPARC64 compile breaking

From: Ahmed Khanzada <[email-masked]>
Date: Wed, 27 Jan 2021 20:06:01 -0800

Eli Zaretskii <[email-masked]> writes:

> On January 26, 2021 8:57:18 AM GMT+02:00, Ahmed Khanzada <[email-masked]> wrote:
>> Not sure if the patch attached correctly. Trying again.
>
>
> Thanks.  However, could you please show the C-level backtrace from the SIGBUS crash, as displayed by GDB?  I think we'd like to know which string has its data unaligned to cause this.

Is the log below the information that you are looking for?

Starting program: /home/enzuru/src/emacs/src/bootstrap-emacs

Breakpoint 1, hash_string (ptr=0x47fa34d596 "DndProtocol", len=11) at
fns.c:4602
4602      EMACS_UINT const *p   = (EMACS_UINT const *) ptr;
(gdb) info args
ptr = 0x47fa34d596 "DndProtocol"
len = 11
(gdb) next
4603      EMACS_UINT const *end = (EMACS_UINT const *) (ptr + len);
(gdb) next
4604      EMACS_UINT hash = len;
(gdb) next
4607      ptrdiff_t step = 1 + ((end - p) >> 3);
(gdb) next
4611      while (p <= end - 1)
(gdb) next
4613          EMACS_UINT c = *p;
(gdb) next

Program received signal SIGBUS, Bus error.
0x000000455fe1dc6c in hash_string (ptr=0x47fa34d596 "DndProtocol",
len=11) at fns.c:4613
4613          EMACS_UINT c = *p;
(gdb) backtrace
#0  0x000000455fe1dc6c in hash_string (ptr=0x47fa34d596 "DndProtocol",
len=11) at fns.c:4613
#1  0x000000455fe1dd48 in sxhash_string (ptr=0x47fa34d596 "DndProtocol",
len=11) at fns.c:4640
#2  0x000000455fe1e36c in sxhash_obj (obj=0x47fa02f0bc, depth=0) at
fns.c:4759
#3  0x000000455fe1e270 in sxhash (obj=0x47fa02f0bc) at fns.c:4741
#4  0x000000455fe1c52c in hashfn_equal (key=0x47fa02f0bc,
h=0x47fa02eff0) at fns.c:4096
#5  0x000000455fe1cf44 in hash_table_rehash (hash=0x47fa02eff5) at
fns.c:4342
#6  0x000000455fdc5264 in hash_table_thaw (hash=0x47fa02eff5) at
pdumper.c:2652
#7  0x000000455fdcd184 in thaw_hash_tables () at pdumper.c:5477
#8  0x000000455fdcccf0 in pdumper_load (dump_filename=0x4832495d00
"/home/enzuru/src/emacs/src/bootstrap-emacs.pdmp") at pdumper.c:5405
#9  0x000000455fcea4ac in load_pdump (argc=1, argv=0xffffffffffff2968)
at emacs.c:859
#10 0x000000455fceabec in main (argc=1, argv=0xffffffffffff2968) at
emacs.c:1067