http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46279
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-11-02 21:33:18 UTC --- Though -O3 generates much larger code. What needs to be done is that one thing really: if (j < k) a[i] = 1; else a[i] = j; Needs to be transformed into: if (j < k) tmp = 1; else tmp = j; a[i] = tmp; And then it should work correctly. I think there is already a bug about that.