<html style="direction: ltr;">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0.2cm; margin-top: 0pt; } </style>
</head>
<body bidimailui-detected-decoding-type="UTF-8" bgcolor="#FFFFFF"
text="#000000">
On 04/05/2012 02:28 PM, Nadav Har'El wrote:
<blockquote
cite="mid:20120405112842.GB23979@fermat.math.technion.ac.il"
type="cite">
<pre wrap="">
I tried to avoid the details, but since you asked, here they are.
Imagine code like this:
        extern int flag;
        ...
        void f(){
                int i;
                if (flag)
                        i=0;        
                g();
                if (flag)
                        dosomething(i);
        }
Now, the compiler (starting a certain version of GCC, with high enough
optimization setting) will warn that i may be used without being set.
Why? After all, it is only used if flag is true, and in that case, i
*was* set. Well, the problem is that the compiler can't know that flag
isn't changed in the middle of the function call, perhaps by another
thread. Perhaps in the call to g(). But *I* know that it can't - this
program is single-threaded, g() does nothing to the flag, and in fact
"flag" is never changed after initialization.
</pre>
</blockquote>
Yes, the warning's name was abbreviated for the sake of clarity to
include the most common case. The complete warning message is:<br>
"Variable used before being initialized, or a missed optimization
opportunity"<br>
<br>
Shachar<br>
<pre class="moz-signature" cols="72">--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
<a class="moz-txt-link-freetext" href="http://www.lingnu.com">http://www.lingnu.com</a>
</pre>
</body>
</html>