Subject: 27.0.50; crash in json tests
From: Andy Moreton <[email-masked]>
To: [email-masked]
Date: Tue, 7 Aug 2018 00:15:42 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Running "make check" for a Windows mingw64 x86_64 build (configured
--with-json) results in a crash in the tests from test/src/json-tests.el.

Attaching GDB shows:

(gdb) bt
#0  0x00007ffdd5e8c903 in KERNELBASE!DebugBreak () from 
C:\WINDOWS\System32\KernelBase.dll
#1  0x000000040021af70 in emacs_abort () at 
C:/emacs/git/emacs/master/src/w32fns.c:10775
#2  0x00000004000efb6c in terminate_due_to_signal (sig=0xb, 
backtrace_limit=<optimized out>) at 
C:/emacs/git/emacs/master/src/emacs.c:399
#3  0x00000004001102b0 in handle_fatal_signal (sig=0xcf0000, 
sig@entry=0xb) at C:/emacs/git/emacs/master/src/sysdep.c:1769
#4  0x000000040010ff58 in deliver_thread_signal (sig=0xb, 
handler=0x4001102a2 <handle_fatal_signal>) at 
C:/emacs/git/emacs/master/src/sysdep.c:1743
#5  0x000000040010ff75 in deliver_fatal_thread_signal (sig=0xcf0000) at 
C:/emacs/git/emacs/master/src/sysdep.c:1781
#6  0x000000040028348c in _gnu_exception_handler 
(exception_data=0xbf5610) at 
C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt_handler.c:223
#7  0x00007ffdd9327c58 in msvcrt!__C_specific_handler () from 
C:\WINDOWS\System32\msvcrt.dll
#8  0x00007ffdd97beced in ntdll!.chkstk () from 
C:\WINDOWS\SYSTEM32\ntdll.dll
#9  0x00007ffdd9726c86 in ntdll!RtlWalkFrameChain () from 
C:\WINDOWS\SYSTEM32\ntdll.dll
#10 0x00007ffdd97bdc1e in ntdll!KiUserExceptionDispatcher () from 
C:\WINDOWS\SYSTEM32\ntdll.dll
#11 0x00007ffdd9730317 in ntdll!RtlFreeHeap () from 
C:\WINDOWS\SYSTEM32\ntdll.dll
#12 0x00007ffdd93198bc in msvcrt!free () from C:\WINDOWS\System32\msvcrt.dll
#13 0x0000000400187d8d in do_one_unbind 
(this_binding=this_binding@entry=0xbf65f0, 
unwinding=unwinding@entry=0x1, 
bindflag=bindflag@entry=SET_INTERNAL_UNBIND) at 
C:/emacs/git/emacs/master/src/eval.c:3473
#14 0x0000000400188f75 in unbind_to (count=count@entry=0x6b, 
value=XIL(0x41cc154)) at C:/emacs/git/emacs/master/src/eval.c:3593
#15 0x0000000400274980 in Fjson_serialize (nargs=<optimized out>, 
args=0xbf69b8) at C:/emacs/git/emacs/master/src/json.c:610
#16 0x000000040018b92f in funcall_subr (subr=0x4006657e0 
<Sjson_serialize>, numargs=numargs@entry=0x1, args=args@entry=0xbf69b8) 
at C:/emacs/git/emacs/master/src/eval.c:2877
...
[another 150 frames omitted]

Lisp Backtrace:
"json-serialize" (0xbf69b8)
"apply" (0xbf69b0)
"byte-optimize-form-code-walker" (0xbf6ee0)
"byte-optimize-form" (0xbf7148)
"mapcar" (0xbf73a0)
"byte-optimize-form-code-walker" (0xbf78e0)
"byte-optimize-form" (0xbf7b80)
"byte-optimize-body" (0xbf7de0)
"byte-optimize-form-code-walker" (0xbf8310)
"byte-optimize-form" (0xbf85b0)
"byte-optimize-form-code-walker" (0xbf8ae0)
"byte-optimize-form" (0xbf8d60)
0xba8e40 PVEC_COMPILED
"mapcar" (0xbf91c8)
"byte-optimize-form-code-walker" (0xbf9700)
"byte-optimize-form" (0xbf99a0)
"byte-optimize-body" (0xbf9bf8)
"byte-optimize-form-code-walker" (0xbfa130)
"byte-optimize-form" (0xbfa3c8)
"byte-compile-top-level" (0xbfa6a0)
"byte-compile-lambda" (0xbfa9e8)
"byte-compile-function-form" (0xbfac38)
"byte-compile-form" (0xbfb028)
"mapc" (0xbfb238)
"byte-compile-normal-call" (0xbfb4a8)
"byte-compile-form" (0xbfb898)
"mapc" (0xbfbaa8)
"byte-compile-normal-call" (0xbfbd18)
"byte-compile-form" (0xbfc120)
"byte-compile-keep-pending" (0xbfc360)
"byte-compile-file-form" (0xbfc588)
0xb2ee40 PVEC_COMPILED
"byte-compile-recurse-toplevel" (0xbfc9e8)
0xbcbca0 PVEC_COMPILED
"mapcar" (0xbfce28)
"byte-compile-recurse-toplevel" (0xbfd068)
"byte-compile-toplevel-file-form" (0xbfd270)
0xb2af70 PVEC_COMPILED
"byte-compile-from-buffer" (0xbfd890)
"byte-compile-file" (0xbfdcb8)
"batch-byte-compile-file" (0xbfdf40)
"batch-byte-compile" (0xbfe268)
"command-line-1" (0xbfe930)
"command-line" (0xbff1c8)
"normal-top-level" (0xbff550)

(gdb) frame 15
#15 0x0000000400274980 in Fjson_serialize (nargs=<optimized out>, 
args=0xbf69b8) at C:/emacs/git/emacs/master/src/json.c:610
610       return unbind_to (count, json_build_string (string));

(gdb) info locals
count = 0x6b
conf = {
   object_type = json_object_hashtable,
   null_object = XIL(0x15e0),
   false_object = XIL(0xa80)
}
json = <optimized out>
string = 0x4206870 "{\"abc\":[1,2,true],\"def\":null}"
(gdb)