It's not unusual for optimisation settings to reveal bugs. You're lucky that the bug happens with lower optimisation, as that should be easier to debug than the other case. Can you trigger the bug in the debugger?
The stack trace seems clear to me. In thread 5, method Generate::randomSwap has hit a stack guard. One possibility is that you have run out of stack. Do you allocate large data structures on the stack? It does not seem to be a case of excessive recursion. The other possibility is that you are doing pointer arithmetic on a pointer to something on the stack, and you have gone out of bounds. Maybe someone else can extract some more clues from the stack log.