@dseligo: Try specifying optimization, such as -O1. The compiler by default generates conservative instructions, which gets optimized by the peephole optimizer.
Thanks, that was the cause.
I struggled to find it for a while. I tried to set optimization level in Lazarus' Project Options without success,
This was inserted in the top of the source when I created it with '[Embedded GUI] AVR-Project (Arduino)' in Lazarus:
Once I removed O- everything worked.