Eureka! I compiled my code with -O in place of -O3 and the program work flowlessly. I can now use the engine in my test environment for hours without problems.Ras wrote:I guess the compiler optimisation can be an issue here. In C, the compiler is free to re-order non-volatile memory access as long as the result is equivalent - under the assumption that no undefined behaviour happens.
But crashing is pretty much the most undefined behaviour possible.
So it may happen that the compiler is moving the crashing instruction before the printf although in the source text, it is after the printf.
On the CPU level with out-of-order execution of modern x86 CPUs, there may be some additional fun.
Anyway, and continuing this hot thread and the topic, I will describe another bug I have that is only seen when playing FICS though winboard. After a few moves in the first game, the program exits in a assert sentence. Repeating the test again exits in another assert (and so on if repeated, always in the same two or three assesrt when domove() after a long search). This time, surely, it is a bug in my code and not the compiler. The problem I have is the difficult to track the bug, any test is a test in FICS that ends in a disconnection, and it costs me a lot to divise where the problem is. The are a lot of timing conditions, commands and so on that could be the problem.
My question is, how in this case, would be a good strategy to catch this bug which is not reproducible in console and debugger?
thanks in advance...

