------- Comment #1 from rguenth at gcc dot gnu dot org 2010-08-04 13:09 ------- The reasoning of GCC goes as follows. There is a partial redundancy along the two invocations of get(), as c[i] is possibly clobbered by f(). So we transform g() to
if (i >= 3) f(); tem1 = c[i]; if (i >= 3) { f(); tem2 = c[i]; } else tem2 = tem1; return tem1 + tem2; now you can see that the load to tem2 is _always_ accessing c with an out-of-bound index. There is no code in the warning machinery to restrict the "is above" warning to code regions that are always executed. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |diagnostic Last reconfirmed|0000-00-00 00:00:00 |2010-08-04 13:09:50 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45180