Fix warnings in -O3 mode

Enable optimisation by default.