minus wrote:
This 'little' program behaves bad when compiled with -O. It works fine when no -O or -O0 is used.
You need to debug and find out exactly what went wrong. You don't even know this is a compiler problem yet (lots of user errors in code show up only if the optimizer is active, e.g. those coming from uninitialized local variables). Then if you can show a clear bug in code generation, then file a bug report.