Program received signal SIGSEGV, Segmentation fault.
0x1200036bc in create_possible_moves (dice_to_set=2, w=0x11ffff810,
actual_pin=1) at allow.c:69
69 Pin[maxpin].color == turn))
(gdb) p maxpin
$1 = -2039
The fix posted previously exposed the above bug.
Here is a possible change for allow.c
Alethion:~/xgammon-0.98a$ diff -ed ~/xgammon-0.98a.orig/allow.c allow.c
69c
Pin[maxpin].color == turn &&
maxpin >= 0))
.
I'm not sure this is correct, but the program no longer crashes.
Well, duh... C doesn't guarantee order of evaluation. If maxpin is <
zero the SIGSEGV will still occur.
I submit the following correction:
Alethion:~/xgammon-0.98a$ diff -ed ~/xgammon-0.98a.orig/allow.c allow.c
68,69c
while (!(Pin[maxpin < 0 ? 0 : maxpin].count &&
Pin[maxpin < 0 ? 0 : maxpin].color == turn))
Of course, the real issue is how maxpin gets a value < zero. That's
beyond my ken.
Realizing he doesn't know C
as he thought,
jec