<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On May 13, 2011, at 10:33 AM, Kaelyn Uhrain 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-align: -webkit-auto; 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; ">Once I added the declaration "void fatal() __attribute__ ((noreturn));", clang's static analyzer no longer complained that x might be uninitialized.  I haven't looked into the code, but I suspect that either the analyzer isn't propagating the noreturn function attribute properly (in cases where the only return path in a function hits a call to another function marked as noreturn) or possibly that the attribute is missing in a key spot within a header.</span></blockquote></div><br><div>Right now there is no propagation of the noreturn attribute because the analyzer isn't doing any inter-procedural analysis.</div><div><br></div><div>I have two thoughts on this:</div><div><br></div><div>1) Eventually do this propagation automatically.  This will not always be correct, however, because we can only infer this when the implementation of the function is available.</div><div><br></div><div>2) Warn when a function that never returns does not have the noreturn attribute.  I believe the compiler may already do this.</div><div><br></div><div>The benefit of (2) is that it also teaches the compiler that a function doesn't return when called.  This allows it to do a variety of optimizations in the caller.  Beyond whatever it gets from inlining, the compiler will never do full auto-propagation of the noreturn attribute.</div></body></html>