------- Comment #6 from rguenth at gcc dot gnu dot org 2010-01-31 11:17 ------- (In reply to comment #5) > Isn't this a wrong-code bug? Or is the information used for the diagnostic > not > used by the optimizers?
The diagnostics are independent on the optimizers, the one diagnostic that isn't (that is emitted from the optimizer itself) causes the optimizer to not optimize (well, because it saw the problem and thus there is no point in breaking things just because we can). The general problem is that alias analysis is hard, thus follows that proper warnings are equally hard. All warnings we emit are either possible false positives or if they are not the optimizers will not miscompile your code because they know there is an alias even though type-based analysis says there is not (well, this is exactly the case you want to warn about, but as analysis is hard once you can tell you can as well not exploit the mis-optimization opportunity). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41874