Subject: 2.1.7 segfaults on cygwin
From: szgyg <[email-masked]>
To: [email-masked]
Date: Wed, 1 Mar 2017 11:27:09 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

I got two identical segfaults from make -j2 on 32-bit cygwin, and
three identical segfaults from make -j3 on 64-bit at the same point.

Any idea?

-----------------

Making all in bootstrap
make[2]: Entering directory '/home/szgyg/usr/src/CYGPORT/guile2-2.1.7-0.i686/build/bootstrap'
  BOOTSTRAP GUILEC ice-9/eval.go
wrote `ice-9/eval.go'
  BOOTSTRAP GUILEC ice-9/psyntax-pp.go
  BOOTSTRAP GUILEC language/cps/intmap.go
*** starting debugger for pid 5024, tid 4568
*** starting debugger for pid 5060, tid 1904

----------------

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 5024.0x11d8]
vm_regular_engine (thread=0x20081e40, vp=0x200f0f78, registers=0x22c480,
    resume=0) at /usr/src/debug/guile2-2.1.7-0/libguile/vm-engine.c:1840
1840          *dst_loc = src;

(gdb) info locals
src = 0x7ff800d8
dst_loc = 0x7ff8d00c
op = 63
jump_table_ = {0x64b956d1 <vm_regular_engine+145>,
[...]

(gdb) print *dst_loc
$3 = (void *) 0x0

(gdb) print *dst_loc = src
Cannot access memory at address 0x7ff8d00c

(gdb) print argv[13]
$16 = 0x612eba68 "language/cps/intmap.go"

---------------------

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 5060.0x770]
vm_regular_engine (thread=0x20081e40, vp=0x200f0f78, registers=0x22c480,
    resume=0) at /usr/src/debug/guile2-2.1.7-0/libguile/vm-engine.c:1840
1840          *dst_loc = src;

(gdb) info locals
src = 0x7ff800d8
dst_loc = 0x7ff8d00c
op = 63
jump_table_ = {0x64b956d1 <vm_regular_engine+145>,
[...]

(gdb) print argv[13]
$6 = 0x612eba68 "ice-9/psyntax-pp.go"

-----------------------

Making all in bootstrap
make[2]: Entering directory '/home/szgyg/usr/src/CYGPORT/guile/guile2-2.1.7-0.x86_64/build/bootstrap'
  BOOTSTRAP GUILEC ice-9/eval.go
wrote `ice-9/eval.go'
  BOOTSTRAP GUILEC ice-9/psyntax-pp.go
  BOOTSTRAP GUILEC language/cps/intmap.go
*** starting debugger for pid 9848, tid 6772
  BOOTSTRAP GUILEC language/cps/intset.go
*** starting debugger for pid 6600, tid 376
*** starting debugger for pid 10136, tid 9064

--------------------------

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 6600.0x178]
vm_regular_engine (thread=0x600091e00, vp=0x600131f30, registers=0x1, resume=0)
    at /usr/src/debug/guile2-2.1.7-0/libguile/vm-engine.c:1840
1840    /usr/src/debug/guile2-2.1.7-0/libguile/vm-engine.c: No such file or directory.
(gdb)

(gdb) info locals
src = 0x6fffffd0128
dst_loc = 0x6fffffdd010
op = 63
jump_table_ = {0x4236bece4 <vm_regular_engine+180>, 0x4236bed84 <vm_regular_engine+340>,
[...]

------------------------

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 9848.0x1a74]
vm_regular_engine (thread=0x600091e00, vp=0x600130f30, registers=0x1, resume=0)
    at /usr/src/debug/guile2-2.1.7-0/libguile/vm-engine.c:1840
1840    /usr/src/debug/guile2-2.1.7-0/libguile/vm-engine.c: No such file or directory.

(gdb) info locals
src = 0x6fffffd0128
dst_loc = 0x6fffffdd010
op = 63
jump_table_ = {0x4236bece4 <vm_regular_engine+180>, 0x4236bed84 <vm_regular_engine+340>,
[...]

-------------------------

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 10136.0x2368]
vm_regular_engine (thread=0x600091e00, vp=0x600131f30, registers=0x1, resume=0)
    at /usr/src/debug/guile2-2.1.7-0/libguile/vm-engine.c:1840
1840    /usr/src/debug/guile2-2.1.7-0/libguile/vm-engine.c: No such file or directory.

(gdb) info locals
src = 0x6fffffd0128
dst_loc = 0x6fffffdd010
op = 63
jump_table_ = {0x4236bece4 <vm_regular_engine+180>, 0x4236bed84 <vm_regular_engine+340>,
[...]

-----------------------

$ less -N +g1840 vm-engine.c
   1821   /* static-patch! _:24 dst-offset:32 src-offset:32
   1822    *
   1823    * Patch a pointer at DST-OFFSET to point to SRC-OFFSET.  Both offsets
   1824    * are signed 32-bit values, indicating a memory address as a number
   1825    * of 32-bit words away from the current instruction pointer.
   1826    */
   1827   VM_DEFINE_OP (63, static_patch, "static-patch!", OP3 (X32, LO32, L32))
   1828     {
   1829       scm_t_int32 dst_offset, src_offset;
   1830       void *src;
   1831       void** dst_loc;
   1832
   1833       dst_offset = ip[1];
   1834       src_offset = ip[2];
   1835
   1836       dst_loc = (void **) (ip + dst_offset);
   1837       src = ip + src_offset;
   1838       VM_ASSERT (ALIGNED_P (dst_loc, void*), abort());
   1839
   1840       *dst_loc = src;
   1841
   1842       NEXT (3);
   1843     }
   1844