I got the same problem using gcc 4.3.2 64-bit under Ubuntu 8.10. It seems that the compiler treats enums as unsigned ints and messes up with the initialization of the attacks tables. Anyway, this is how I solved it:Aaron Becker wrote:Hmm, I'm not sure what the problem might be. I used gcc and Ubuntu for my linux testing as well, although not exactly the same versions. I think I need a little more information to find the problem.Volker Pittlik wrote: I get a segmentation fault here after compiling it without errors.
volker@vpittlik:~/schach/daydreamer/1.0$ gcc --version
gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
volker@vpittlik:~/schach/daydreamer/1.0$ uname -a
Linux vpittlik 2.6.24-24-generic #1 SMP Fri Jul 24 22:15:50 UTC 2009 x86_64 GNU/Linux
vp
Is this a 64-bit executable? I only tested 32-bit versions so far, so there may be problems lurking in a 64-bit build. Does it segfault as soon as you start it up, or only after it starts to search? Does it print any output at all, other than "segmentation fault"?
You can build a debugging version by running "make debug". Trying that version might shed some light on the problem. Best of all would be to run the debug version inside gdb--then when it crashes it will give a full stack trace, which should be enough to pinpoint the problem.
Sorry for the trouble, and thanks for any help you can give me in tracking the problem down.
In position.h replace
Code: Select all
typedef enum {
A1=0x00, B1=0x01, C1=0x02, D1=0x03, E1=0x04, F1=0x05, G1=0x06, H1=0x07,
A2=0x10, B2=0x11, C2=0x12, D2=0x13, E2=0x14, F2=0x15, G2=0x16, H2=0x17,
A3=0x20, B3=0x21, C3=0x22, D3=0x23, E3=0x24, F3=0x25, G3=0x26, H3=0x27,
A4=0x30, B4=0x31, C4=0x32, D4=0x33, E4=0x34, F4=0x35, G4=0x36, H4=0x37,
A5=0x40, B5=0x41, C5=0x42, D5=0x43, E5=0x44, F5=0x45, G5=0x46, H5=0x47,
A6=0x50, B6=0x51, C6=0x52, D6=0x53, E6=0x54, F6=0x55, G6=0x56, H6=0x57,
A7=0x60, B7=0x61, C7=0x62, D7=0x63, E7=0x64, F7=0x65, G7=0x66, H7=0x67,
A8=0x70, B8=0x71, C8=0x72, D8=0x73, E8=0x74, F8=0x75, G8=0x76, H8=0x77,
INVALID_SQUARE=0x4b // just some square from the middle of the invalid part
} square_t;
Code: Select all
enum {
A1=0x00, B1=0x01, C1=0x02, D1=0x03, E1=0x04, F1=0x05, G1=0x06, H1=0x07,
A2=0x10, B2=0x11, C2=0x12, D2=0x13, E2=0x14, F2=0x15, G2=0x16, H2=0x17,
A3=0x20, B3=0x21, C3=0x22, D3=0x23, E3=0x24, F3=0x25, G3=0x26, H3=0x27,
A4=0x30, B4=0x31, C4=0x32, D4=0x33, E4=0x34, F4=0x35, G4=0x36, H4=0x37,
A5=0x40, B5=0x41, C5=0x42, D5=0x43, E5=0x44, F5=0x45, G5=0x46, H5=0x47,
A6=0x50, B6=0x51, C6=0x52, D6=0x53, E6=0x54, F6=0x55, G6=0x56, H6=0x57,
A7=0x60, B7=0x61, C7=0x62, D7=0x63, E7=0x64, F7=0x65, G7=0x66, H7=0x67,
A8=0x70, B8=0x71, C8=0x72, D8=0x73, E8=0x74, F8=0x75, G8=0x76, H8=0x77,
INVALID_SQUARE=0x4b // just some square from the middle of the invalid part
};
typedef int square_t;