------- Comment #8 from davidxl at gcc dot gnu dot org 2010-04-21 00:27 ------- (In reply to comment #2) > Note this is not fully a regression but really a progression. > What is happening now is only partial optimizations is happen before the > warning to happen. > > >I was unable to reduce the test case further without making the warning > >disappear. In particular, removing the increment of v1->count makes the > >warning > >disappear. > This is because we would then jump thread he jump. > > Again this is because we are emitting the warning too soon, I might be able > to come up with a testcase > which shows that this is not really a regression but a progression in that we > have warned in 3.4 and > 4.0: > struct {int count;} *v1; > int c; > int k; > > extern void baz(int); > void foo(void) > { > int i; > int r; > if (k == 4) > { > i = 1; > r = 1; > } > else > r = 0; > > if (!r) > { > if (!c) > return; > v1->count++; > } > if (!c) > { > baz(i); > } > } > > There is no different from the case above and the functions you gave below. > > There has been some talking about moving where we warn about uninitialized > variables but I feel that > you can get around this in your code.
To reproduce the problem -- -fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp are needed. This -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20968