Subject: bug#75790: 29.4; (void-function nil) for completing-read in native compiled function

From: Xinyang Chen <[email-masked]>
Date: Thu, 23 Jan 2025 13:55:59 -0600

sometimes, all native compiled functions calling completing-read start to
report (void-function nil)
```
Debugger entered--Lisp error: (void-function nil)
  nil("M-x " #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_53>
#f(compiled-function (sym) #<bytecode 0x28b0606edbf6eb>) t nil
extended-command-history nil nil)
  read-extended-command-1("M-x " nil)
  read-extended-command()
  ...
```
this only affects native complied functions.

reloading an affected function with `emacs-lisp-native-compile-and-load`
appears to fix the problem for just that function.

disassemble:
```
000000000001b090
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0>:
   1b090: 41 57                 push   %r15
   1b092: 41 56                 push   %r14
   1b094: 41 55                 push   %r13
   1b096: 49 89 f5             mov    %rsi,%r13
   1b099: 41 54                 push   %r12
   1b09b: 49 89 fc             mov    %rdi,%r12
   1b09e: 55                   push   %rbp
   1b09f: 53                   push   %rbx
   1b0a0: 48 81 ec a8 00 00 00 sub    $0xa8,%rsp
   1b0a7: 48 8b 05 1a bf 03 00 mov    0x3bf1a(%rip),%rax        # 56fc8
<freloc_link_table@@Base-0x56048>
   1b0ae: 48 8b 18             mov    (%rax),%rbx
   1b0b1: ff 93 38 1b 00 00     call   *0x1b38(%rbx)
   1b0b7: 4c 8b 3d 02 bf 03 00 mov    0x3bf02(%rip),%r15        # 56fc0
<d_reloc@@Base-0x527a0>
   1b0be: 48 89 44 24 08       mov    %rax,0x8(%rsp)
   1b0c3: 49 8b bf e8 0c 00 00 mov    0xce8(%r15),%rdi
   1b0ca: ff 93 30 22 00 00     call   *0x2230(%rbx)
   1b0d0: 48 8d 74 24 60       lea    0x60(%rsp),%rsi
   1b0d5: bf 03 00 00 00       mov    $0x3,%edi
   1b0da: 4c 8b 35 af be 03 00 mov    0x3beaf(%rip),%r14        # 56f90
<d_reloc_imp@@Base-0x4f890>
   1b0e1: f3 41 0f 7e 87 f0 0c movq   0xcf0(%r15),%xmm0
   1b0e8: 00 00
   1b0ea: 66 48 0f 6e d0       movq   %rax,%xmm2
   1b0ef: 48 89 c5             mov    %rax,%rbp
   1b0f2: 49 8b 86 10 01 00 00 mov    0x110(%r14),%rax
   1b0f9: 66 0f 6c c2           punpcklqdq %xmm2,%xmm0
   1b0fd: 0f 29 44 24 60       movaps %xmm0,0x60(%rsp)
   1b102: 48 89 44 24 70       mov    %rax,0x70(%rsp)
   1b107: ff 93 60 22 00 00     call   *0x2260(%rbx)
   1b10d: 48 89 ef             mov    %rbp,%rdi
   1b110: 48 89 c6             mov    %rax,%rsi
   1b113: ff 93 60 29 00 00     call   *0x2960(%rbx)
   1b119: 66 48 0f 6e dd       movq   %rbp,%xmm3
   1b11e: 48 8d 74 24 10       lea    0x10(%rsp),%rsi
   1b123: f3 41 0f 7e 87 f8 0c movq   0xcf8(%r15),%xmm0
   1b12a: 00 00
   1b12c: bf 02 00 00 00       mov    $0x2,%edi
   1b131: 66 0f 6c c3           punpcklqdq %xmm3,%xmm0
   1b135: 0f 29 44 24 10       movaps %xmm0,0x10(%rsp)
   1b13a: ff 93 60 22 00 00     call   *0x2260(%rbx)
   1b140: 48 89 c7             mov    %rax,%rdi
   1b143: ff 53 50             call   *0x50(%rbx)
   1b146: 48 8d b4 24 80 00 00 lea    0x80(%rsp),%rsi
   1b14d: 00
   1b14e: bf 03 00 00 00       mov    $0x3,%edi
   1b153: f3 41 0f 6f 8f d8 0c movdqu 0xcd8(%r15),%xmm1
   1b15a: 00 00
   1b15c: 48 89 ac 24 90 00 00 mov    %rbp,0x90(%rsp)
   1b163: 00
   1b164: 66 41 0f 12 8f d8 01 movlpd 0x1d8(%r15),%xmm1
   1b16b: 00 00
   1b16d: 0f 29 8c 24 80 00 00 movaps %xmm1,0x80(%rsp)
   1b174: 00
   1b175: ff 93 40 1d 00 00     call   *0x1d40(%rbx)
   1b17b: 49 8b bf 10 01 00 00 mov    0x110(%r15),%rdi
   1b182: ff 93 48 29 00 00     call   *0x2948(%rbx)
   1b188: 49 8b b7 80 08 00 00 mov    0x880(%r15),%rsi
   1b18f: 48 89 c7             mov    %rax,%rdi
   1b192: ff 93 08 2b 00 00     call   *0x2b08(%rbx)
   1b198: 48 85 c0             test   %rax,%rax
   1b19b: 0f 84 9f 00 00 00     je     1b240
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x1b0>
   1b1a1: 49 8b af 98 0f 00 00 mov    0xf98(%r15),%rbp
   1b1a8: 4d 85 e4             test   %r12,%r12
   1b1ab: 0f 84 a7 01 00 00     je     1b358
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x2c8>
   1b1b1: 48 89 6c 24 20       mov    %rbp,0x20(%rsp)
   1b1b6: 48 8d 74 24 20       lea    0x20(%rsp),%rsi
   1b1bb: bf 02 00 00 00       mov    $0x2,%edi
   1b1c0: 4c 89 64 24 28       mov    %r12,0x28(%rsp)
   1b1c5: ff 93 40 26 00 00     call   *0x2640(%rbx)
   1b1cb: 48 8d 74 24 30       lea    0x30(%rsp),%rsi
   1b1d0: bf 02 00 00 00       mov    $0x2,%edi
   1b1d5: f3 41 0f 7e 87 70 0f movq   0xf70(%r15),%xmm0
   1b1dc: 00 00
   1b1de: 48 89 c5             mov    %rax,%rbp
   1b1e1: 0f 16 44 24 08       movhps 0x8(%rsp),%xmm0
   1b1e6: 0f 29 44 24 30       movaps %xmm0,0x30(%rsp)
   1b1eb: ff 93 60 22 00 00     call   *0x2260(%rbx)
   1b1f1: 49 8b 4f 10           mov    0x10(%r15),%rcx
   1b1f5: 4d 89 e8             mov    %r13,%r8
   1b1f8: 48 89 ef             mov    %rbp,%rdi
   1b1fb: 4d 8b 8f 78 0f 00 00 mov    0xf78(%r15),%r9
   1b202: 49 8b b6 20 01 00 00 mov    0x120(%r14),%rsi
   1b209: 6a 00                 push   $0x0
   1b20b: 48 89 c2             mov    %rax,%rdx
   1b20e: 6a 00                 push   $0x0
   1b210: ff 93 d8 13 00 00     call   *0x13d8(%rbx)
   1b216: bf 06 00 00 00       mov    $0x6,%edi
   1b21b: 48 89 c5             mov    %rax,%rbp
   1b21e: ff 53 28             call   *0x28(%rbx)
   1b221: 48 81 c4 b8 00 00 00 add    $0xb8,%rsp
   1b228: 48 89 e8             mov    %rbp,%rax
   1b22b: 5b                   pop    %rbx
   1b22c: 5d                   pop    %rbp
   1b22d: 41 5c                 pop    %r12
   1b22f: 41 5d                 pop    %r13
   1b231: 41 5e                 pop    %r14
   1b233: 41 5f                 pop    %r15
   1b235: c3                   ret
   1b236: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
   1b23d: 00 00 00
   1b240: 49 8b bf 10 01 00 00 mov    0x110(%r15),%rdi
   1b247: 48 89 c5             mov    %rax,%rbp
   1b24a: ff 93 48 29 00 00     call   *0x2948(%rbx)
   1b250: 83 e8 03             sub    $0x3,%eax
   1b253: a8 07                 test   $0x7,%al
   1b255: 48 8b 83 48 29 00 00 mov    0x2948(%rbx),%rax
   1b25c: 75 52                 jne    1b2b0
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x220>
   1b25e: 49 83 7f 10 00       cmpq   $0x0,0x10(%r15)
   1b263: 49 8b bf 10 01 00 00 mov    0x110(%r15),%rdi
   1b26a: 74 44                 je     1b2b0
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x220>
   1b26c: ff d0                 call   *%rax
   1b26e: 48 89 c6             mov    %rax,%rsi
   1b271: 8d 40 fd             lea    -0x3(%rax),%eax
   1b274: a8 07                 test   $0x7,%al
   1b276: 0f 85 94 01 00 00     jne    1b410
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x380>
   1b27c: 48 8b 7e fd           mov    -0x3(%rsi),%rdi
   1b280: be 12 00 00 00       mov    $0x12,%esi
   1b285: ff 93 08 2b 00 00     call   *0x2b08(%rbx)
   1b28b: 48 85 c0             test   %rax,%rax
   1b28e: 74 10                 je     1b2a0
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x210>
   1b290: 49 8b af 90 0f 00 00 mov    0xf90(%r15),%rbp
   1b297: e9 0c ff ff ff       jmp    1b1a8
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x118>
   1b29c: 0f 1f 40 00           nopl   0x0(%rax)
   1b2a0: 48 8b 83 48 29 00 00 mov    0x2948(%rbx),%rax
   1b2a7: 66 0f 1f 84 00 00 00 nopw   0x0(%rax,%rax,1)
   1b2ae: 00 00
   1b2b0: 49 8b bf 10 01 00 00 mov    0x110(%r15),%rdi
   1b2b7: ff d0                 call   *%rax
   1b2b9: 83 e8 03             sub    $0x3,%eax
   1b2bc: a8 07                 test   $0x7,%al
   1b2be: 48 8b 83 48 29 00 00 mov    0x2948(%rbx),%rax
   1b2c5: 0f 85 c5 00 00 00     jne    1b390
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x300>
   1b2cb: 49 83 7f 10 00       cmpq   $0x0,0x10(%r15)
   1b2d0: 49 8b bf 10 01 00 00 mov    0x110(%r15),%rdi
   1b2d7: 0f 84 b3 00 00 00     je     1b390
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x300>
   1b2dd: ff d0                 call   *%rax
   1b2df: 48 89 c6             mov    %rax,%rsi
   1b2e2: 8d 40 fd             lea    -0x3(%rax),%eax
   1b2e5: a8 07                 test   $0x7,%al
   1b2e7: 0f 85 43 01 00 00     jne    1b430
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x3a0>
   1b2ed: 48 8b 7e fd           mov    -0x3(%rsi),%rdi
   1b2f1: 8d 47 fe             lea    -0x2(%rdi),%eax
   1b2f4: a8 03                 test   $0x3,%al
   1b2f6: 75 70                 jne    1b368
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x2d8>
   1b2f8: 49 83 7f 10 00       cmpq   $0x0,0x10(%r15)
   1b2fd: 48 8b 83 48 29 00 00 mov    0x2948(%rbx),%rax
   1b304: 49 8b bf 10 01 00 00 mov    0x110(%r15),%rdi
   1b30b: 0f 84 7f 00 00 00     je     1b390
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x300>
   1b311: ff d0                 call   *%rax
   1b313: 48 89 c6             mov    %rax,%rsi
   1b316: 8d 40 fd             lea    -0x3(%rax),%eax
   1b319: a8 07                 test   $0x7,%al
   1b31b: 0f 85 37 01 00 00     jne    1b458
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x3c8>
   1b321: 48 8b 6e fd           mov    -0x3(%rsi),%rbp
   1b325: 66 48 0f 6e ed       movq   %rbp,%xmm5
   1b32a: 48 8d 74 24 50       lea    0x50(%rsp),%rsi
   1b32f: bf 02 00 00 00       mov    $0x2,%edi
   1b334: f3 41 0f 7e 87 88 0f movq   0xf88(%r15),%xmm0
   1b33b: 00 00
   1b33d: 66 0f 6c c5           punpcklqdq %xmm5,%xmm0
   1b341: 0f 29 44 24 50       movaps %xmm0,0x50(%rsp)
   1b346: ff 93 e8 15 00 00     call   *0x15e8(%rbx)
   1b34c: 48 89 c5             mov    %rax,%rbp
   1b34f: e9 54 fe ff ff       jmp    1b1a8
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x118>
   1b354: 0f 1f 40 00           nopl   0x0(%rax)
   1b358: 4d 8b a7 80 0f 00 00 mov    0xf80(%r15),%r12
   1b35f: e9 4d fe ff ff       jmp    1b1b1
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x121>
   1b364: 0f 1f 40 00           nopl   0x0(%rax)
   1b368: 8d 47 fb             lea    -0x5(%rdi),%eax
   1b36b: a8 07                 test   $0x7,%al
   1b36d: 75 1a                 jne    1b389
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x2f9>
   1b36f: 48 8b 05 52 bc 03 00 mov    0x3bc52(%rip),%rax        # 56fc8
<freloc_link_table@@Base-0x56048>
   1b376: be 02 00 00 00       mov    $0x2,%esi
   1b37b: 48 8b 00             mov    (%rax),%rax
   1b37e: ff 50 08             call   *0x8(%rax)
   1b381: 84 c0                 test   %al,%al
   1b383: 0f 85 6f ff ff ff     jne    1b2f8
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x268>
   1b389: 48 8b 83 48 29 00 00 mov    0x2948(%rbx),%rax
   1b390: 49 8b bf 10 01 00 00 mov    0x110(%r15),%rdi
   1b397: ff d0                 call   *%rax
   1b399: 48 89 c7             mov    %rax,%rdi
   1b39c: 8d 40 fe             lea    -0x2(%rax),%eax
   1b39f: a8 03                 test   $0x3,%al
   1b3a1: 74 25                 je     1b3c8
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x338>
   1b3a3: 8d 47 fb             lea    -0x5(%rdi),%eax
   1b3a6: a8 07                 test   $0x7,%al
   1b3a8: 0f 85 fa fd ff ff     jne    1b1a8
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x118>
   1b3ae: 48 8b 05 13 bc 03 00 mov    0x3bc13(%rip),%rax        # 56fc8
<freloc_link_table@@Base-0x56048>
   1b3b5: be 02 00 00 00       mov    $0x2,%esi
   1b3ba: 48 8b 00             mov    (%rax),%rax
   1b3bd: ff 50 08             call   *0x8(%rax)
   1b3c0: 84 c0                 test   %al,%al
   1b3c2: 0f 84 e0 fd ff ff     je     1b1a8
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x118>
   1b3c8: 49 83 7f 10 00       cmpq   $0x0,0x10(%r15)
   1b3cd: 0f 84 d5 fd ff ff     je     1b1a8
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x118>
   1b3d3: 49 8b bf 10 01 00 00 mov    0x110(%r15),%rdi
   1b3da: ff 93 48 29 00 00     call   *0x2948(%rbx)
   1b3e0: 48 8d 74 24 40       lea    0x40(%rsp),%rsi
   1b3e5: bf 02 00 00 00       mov    $0x2,%edi
   1b3ea: f3 41 0f 7e 87 88 0f movq   0xf88(%r15),%xmm0
   1b3f1: 00 00
   1b3f3: 66 48 0f 6e e0       movq   %rax,%xmm4
   1b3f8: 66 0f 6c c4           punpcklqdq %xmm4,%xmm0
   1b3fc: 0f 29 44 24 40       movaps %xmm0,0x40(%rsp)
   1b401: ff 93 e8 15 00 00     call   *0x15e8(%rbx)
   1b407: 48 89 c5             mov    %rax,%rbp
   1b40a: e9 99 fd ff ff       jmp    1b1a8
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x118>
   1b40f: 90                   nop
   1b410: 48 85 f6             test   %rsi,%rsi
   1b413: 74 13                 je     1b428
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x398>
   1b415: 48 8b 05 ac bb 03 00 mov    0x3bbac(%rip),%rax        # 56fc8
<freloc_link_table@@Base-0x56048>
   1b41c: 49 8b bf a0 38 00 00 mov    0x38a0(%r15),%rdi
   1b423: 48 8b 00             mov    (%rax),%rax
   1b426: ff 10                 call   *(%rax)
   1b428: 31 ff                 xor    %edi,%edi
   1b42a: e9 51 fe ff ff       jmp    1b280
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x1f0>
   1b42f: 90                   nop
   1b430: 48 85 f6             test   %rsi,%rsi
   1b433: 0f 84 50 ff ff ff     je     1b389
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x2f9>
   1b439: 48 8b 05 88 bb 03 00 mov    0x3bb88(%rip),%rax        # 56fc8
<freloc_link_table@@Base-0x56048>
   1b440: 49 8b bf a0 38 00 00 mov    0x38a0(%r15),%rdi
   1b447: 48 8b 00             mov    (%rax),%rax
   1b44a: ff 10                 call   *(%rax)
   1b44c: e9 38 ff ff ff       jmp    1b389
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x2f9>
   1b451: 0f 1f 80 00 00 00 00 nopl   0x0(%rax)
   1b458: 48 85 f6             test   %rsi,%rsi
   1b45b: 0f 84 c4 fe ff ff     je     1b325
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x295>
   1b461: 48 8b 05 60 bb 03 00 mov    0x3bb60(%rip),%rax        # 56fc8
<freloc_link_table@@Base-0x56048>
   1b468: 49 8b bf a0 38 00 00 mov    0x38a0(%r15),%rdi
   1b46f: 48 8b 00             mov    (%rax),%rax
   1b472: ff 10                 call   *(%rax)
   1b474: e9 ac fe ff ff       jmp    1b325
<F726561642d657874656e6465642d636f6d6d616e642d31_read_extended_command_1_0+0x295>
   1b479: 0f 1f 80 00 00 00 00 nopl   0x0(%rax)
```