------- Comment #5 from rakdver at gcc dot gnu dot org 2009-04-26 18:37 ------- (In reply to comment #4) > void foo(int *); > void f2(int dst[3], int R) > { > int i, inter[2]; > > for (i = 1; i < R; i++) { > inter[0] = 1; > inter[1] = 1; > } > > foo(inter); > } > > Warns at -Os or also at -O2 if you disable loop header copying.
Right. The initial value of inter may reach the call to foo (when R <= 1), so we must issue (and keep) the loads if we want to perform lsm without loop header copying. While I recognize that adding the loads from (possibly) uninitialized memory is somewhat annoying, limiting lsm only to loops where we can prove that this does not happen does not make much sense, either. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39612