Skip to content

Instantly share code, notes, and snippets.

@Hamayama
Last active June 16, 2017 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hamayama/e3e61daf09a4a0dafe3c503c21904947 to your computer and use it in GitHub Desktop.
Save Hamayama/e3e61daf09a4a0dafe3c503c21904947 to your computer and use it in GitHub Desktop.
boehmgc issue #167 memo
7.7.0 (master): MinGW: gctest.exe fails
from #166
> 1. Could you please recheck it using master branch of bdwgc (with any libatomic_ops)?
> 2. Same as 1 plus --disable-parallel-mark --enable-gc-assertions
> 3. Same as 2 plus comment out THREAD_LOCAL_ALLOC definition in include/config.h
I tried a master branch, but I got many failures.
(A1) I tried master branch. (Next, I will add options.)
GC: gc-7.7.0-01f83d4.zip and libatomic_ops-7.6.0.tar.gz
- **testA:**
./autogen.sh
./configure --enable-threads=win32 --enable-large-config --disable-gcj-support CPPFLAGS="-DDONT_ADD_BYTE_AT_END "
make check
COUNT=0; while :; do ./gctest.exe; (( COUNT++ )); echo $COUNT; done
**result:**
TOTAL COUNT: 200
PASS: 57
FAIL(Segmentation fault): 143
- **testB:**
libtool --mode=execute gdb gctest.exe
Input 'r' command repeatedly until error occurs.
**result:**
```
Thread 8 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 10192.0xc64]
GC_reclaim_block (hbp=0x525000, report_if_found=0) at reclaim.c:443
443 hhdr -> hb_next = *rlh;
(gdb) p rlh
$1 = (struct hblk **) 0x50
(gdb) p *rlh
Cannot access memory at address 0x50
(gdb) bt
#0 GC_reclaim_block (hbp=0x525000, report_if_found=0) at reclaim.c:443
#1 0x000000006e7c88fa in GC_apply_to_all_blocks (
fn=0x6e7d14e0 <GC_reclaim_block>, client_data=0) at headers.c:324
#2 0x000000006e7d1b55 in GC_start_reclaim (
report_if_found=report_if_found@entry=0) at reclaim.c:649
#3 0x000000006e7c2f1f in GC_finish_collection () at alloc.c:991
#4 0x000000006e7c9ddd in GC_generic_malloc_many (lb=lb@entry=160,
k=k@entry=0, result=result@entry=0x2ecfb78) at mallocx.c:308
#5 0x0000000000402b0d in test_tinyfl () at tests/test.c:1029
#6 0x0000000000403044 in run_one_test () at tests/test.c:1252
#7 0x00000000004038f9 in thr_run_one_test (arg=arg@entry=0x0)
at tests/test.c:1932
#8 0x000000006e7d37b3 in GC_win32_start_inner (sb=sb@entry=0x2ecff00,
arg=0x520fc0) at win32_threads.c:2183
#9 0x000000006e7ce198 in GC_call_with_stack_base (
fn=fn@entry=0x6e7d3790 <GC_win32_start_inner>, arg=<optimized out>)
at misc.c:1941
#10 0x000000006e7d2ff3 in GC_win32_start (arg=<optimized out>)
at win32_threads.c:2201
#11 0x00007ffa8e3513d2 in KERNEL32!BaseThreadInitThunk ()
from C:\WINDOWS\system32\kernel32.dll
#12 0x00007ffa8e8154e4 in ntdll!RtlUserThreadStart ()
from C:\WINDOWS\SYSTEM32\ntdll.dll
#13 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
```
(A2) I added options. (Next, I will change include/config.h.)
GC: gc-7.7.0-01f83d4.zip and libatomic_ops-7.6.0.tar.gz
- **testA:**
./autogen.sh
./configure --disable-parallel-mark --enable-gc-assertions --enable-threads=win32 --enable-large-config --disable-gcj-support CPPFLAGS="-DDONT_ADD_BYTE_AT_END "
make check
COUNT=0; while :; do ./gctest.exe; (( COUNT++ )); echo $COUNT; done
**result:**
TOTAL COUNT: 200
PASS: 65
FAIL(Segmentation fault): 135
- **testB:**
libtool --mode=execute gdb gctest.exe
Input 'r' command repeatedly until error occurs.
**result:**
```
Thread 1 received signal SIGSEGV, Segmentation fault.
GC_reclaim_block (hbp=0x4da000, report_if_found=0) at reclaim.c:443
443 hhdr -> hb_next = *rlh;
(gdb) p rlh
$1 = (struct hblk **) 0x50
(gdb) p *rlh
Cannot access memory at address 0x50
(gdb) bt
#0 GC_reclaim_block (hbp=0x4da000, report_if_found=0) at reclaim.c:443
#1 0x000000006e7ca9ca in GC_apply_to_all_blocks (
fn=0x6e7d6940 <GC_reclaim_block>, client_data=0) at headers.c:324
#2 0x000000006e7d70f5 in GC_start_reclaim (
report_if_found=report_if_found@entry=0) at reclaim.c:649
#3 0x000000006e7c37af in GC_finish_collection () at alloc.c:991
#4 0x000000006e7ccadb in GC_generic_malloc_many (lb=lb@entry=16,
k=k@entry=1, result=result@entry=0x23fb38) at mallocx.c:308
#5 0x0000000000402c84 in test_tinyfl () at tests/test.c:1030
#6 0x00000000004031b4 in run_one_test () at tests/test.c:1252
#7 0x0000000000403ea2 in WinMain (instance=<optimized out>,
prev=prev@entry=0x0, cmd=<optimized out>, n=<optimized out>)
at tests/test.c:2069
#8 0x0000000000405942 in main (flags=<optimized out>,
cmdline=<optimized out>, inst=<optimized out>)
at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18
#9 0x00000000004013f8 in __tmainCRTStartup ()
at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:334
#10 0x000000000040151b in mainCRTStartup ()
at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:212
```
(A3) I changed include/config.h.
GC: gc-7.7.0-01f83d4.zip and libatomic_ops-7.6.0.tar.gz
- **testA:**
./autogen.sh
./configure --disable-parallel-mark --enable-gc-assertions --enable-threads=win32 --enable-large-config --disable-gcj-support CPPFLAGS="-DDONT_ADD_BYTE_AT_END "
Edit include/config.h (comment out THREAD_LOCAL_ALLOC).
make check
COUNT=0; while :; do ./gctest.exe; (( COUNT++ )); echo $COUNT; done
**result:**
TOTAL COUNT: 200
PASS: 4
FAIL(Segmentation fault): 196
- **testB:**
libtool --mode=execute gdb gctest.exe
Input 'r' command repeatedly until error occurs.
**result:**
```
Thread 4 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 6352.0x650]
GC_reclaim_block (hbp=0x1fd0000, report_if_found=0) at reclaim.c:443
443 hhdr -> hb_next = *rlh;
(gdb) p rlh
$1 = (struct hblk **) 0x50
(gdb) p *rlh
Cannot access memory at address 0x50
(gdb) bt
#0 GC_reclaim_block (hbp=0x1fd0000, report_if_found=0) at reclaim.c:443
#1 0x000000006e7ca90a in GC_apply_to_all_blocks (
fn=0x6e7d6850 <GC_reclaim_block>, client_data=0) at headers.c:324
#2 0x000000006e7d7005 in GC_start_reclaim (
report_if_found=report_if_found@entry=0) at reclaim.c:649
#3 0x000000006e7c36ef in GC_finish_collection () at alloc.c:991
#4 0x000000006e7cca2b in GC_generic_malloc_many (lb=lb@entry=16,
k=k@entry=1, result=result@entry=0x25ffbf8) at mallocx.c:308
#5 0x0000000000402c84 in test_tinyfl () at tests/test.c:1030
#6 0x00000000004031b4 in run_one_test () at tests/test.c:1252
#7 0x0000000000403a69 in thr_run_one_test (arg=arg@entry=0x0)
at tests/test.c:1932
#8 0x000000006e7d96d3 in GC_win32_start_inner (sb=sb@entry=0x25fff00,
arg=0x1fc0fd0) at win32_threads.c:2183
#9 0x000000006e7d2488 in GC_call_with_stack_base (
fn=fn@entry=0x6e7d96b0 <GC_win32_start_inner>, arg=<optimized out>)
at misc.c:1941
#10 0x000000006e7d8843 in GC_win32_start (arg=<optimized out>)
at win32_threads.c:2201
#11 0x00007ffa8e3513d2 in KERNEL32!BaseThreadInitThunk ()
from C:\WINDOWS\system32\kernel32.dll
#12 0x00007ffa8e8154e4 in ntdll!RtlUserThreadStart ()
from C:\WINDOWS\SYSTEM32\ntdll.dll
#13 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
```
(2017-6-16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment