The following tiny procedure: "long long test(long long i) { return i % 4;}"
generates bad code when optimization is set to None; interestingly, when
optimization is set to Maximize Speed the generated code is correct.
The code generated with optimization=None is shown in attachment
noOpt.jpg (captured from the Pelles debugger). The "cqo" instruction
takes its source from rax, but the compiler loads the numerator into
rdx instead. The optimized code (in Opt.jpg) correctly loads the numerator
into rax. There are three other instructions in noOpt.jpg that also reference
rdx when they should be, in this case, using rax.
Compiler is v8.00.60 (64-bit).
Richie