<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jan 26, 2011, at 5:17 PM, Nico Weber wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Hi Ted,<br><br>this adds 265 compile errors to the chrome build (we build with<br>-Werror). I went through the first 40 or so, and they're all false<br>positives. The two most common cases are<br></span></blockquote><div><br></div><div>Hi Nico,</div><div><br></div><div>Thanks for filing these reports.  I expected some fallout from enabling this warning, and I want to see these bugs.</div><div><br></div><div>One thing I want to make clear is that the goal of -Wuninitialized in clang is twofold:</div><div><br></div><div>1) Provide consistent results despite the optimization level used for compilation (or even -O0)</div><div><br></div><div>2) Provide reasonable but conservative results.  I suspect that GCC gives up in many cases.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><br><a href="http://llvm.org/bugs/show_bug.cgi?id=9063">http://llvm.org/bugs/show_bug.cgi?id=9063</a><br></span></blockquote><div><br></div><div>I think there are two cases here, and I've commented in the bug requesting more data.</div><div><br></div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><a href="http://llvm.org/bugs/show_bug.cgi?id=9064">http://llvm.org/bugs/show_bug.cgi?id=9064</a><span class="Apple-converted-space"> </span>(a real bug)<br></span></blockquote><div><br></div><div>Yes this is a glaring omission.  Just need to handle fast enumeration.</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><br>I also filed<br><a href="http://llvm.org/bugs/show_bug.cgi?id=9061">http://llvm.org/bugs/show_bug.cgi?id=9061</a><br></span></blockquote><div><br></div><div>I think this is reasonable to handle, but only for the case where loops have the format:</div><div><br></div><div>  for (int i = 0; i < constant ; ...)</div><div><br></div><div>It's clear that the loop body is always entered.</div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><a href="http://llvm.org/bugs/show_bug.cgi?id=9062">http://llvm.org/bugs/show_bug.cgi?id=9062</a><br></span></blockquote><div><br></div><div>I don't think this is reasonable to do.  I suspect GCC just gets lucky because it's -Wuninitialized implementation in based on the optimizer or that it simply gives up.  There is a control-dependency here that in the general case can only be handled using path-sensitive analysis.  Going back to goals (1) and (2), I think this is one place where we want Clang to be more conservative than GCC.  I suspect many will disagree.</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">At the moment, we will have to disable -Wuninitialized in chrome if we<br>want to update clang (which we _always_ want to do :-) ).<br></span></blockquote></div><br><div>I think 3/4 PRs are reasonable requests to fix.  The only contentious one is 9062, and I don't know if that is a deal breaker for you.</div></body></html>