<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Missing uninitialized variable warning."
   href="https://llvm.org/bugs/show_bug.cgi?id=28872">28872</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing uninitialized variable warning.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mathieu.bosi@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi

Code such as:

 int main(void)
 {
   int value = value; // value is garbage, no warning is generated
   return 0;
 }

Does not trigger any warning.

Using the uninitialized value to access an array or any STL container (e.g.
std::map) does not trigger any warnings either.

e.g.
 std::map<int> hashmap;
 int foo = hashmap[foo];


On the other hand, the proper warning appears in code like this:

 int foo(int bar)
 {
   return bar;
 }
 int main(void)
 {
   int value = foo(value); // <-- proper warning is generated
 }

I'm not even sure why C++ allows such syntax (maybe some kind of shortcut for
non plain-old-data / classes?) but it sure caused a (easy to track down) bug in
the code I was working on.

NOTE: I did not know which clang version to select from the Bugzilla spinner.

'clang --version' returns:

 Apple LLVM version 7.3.0 (clang-703.0.31)
 Target: x86_64-apple-darwin15.6.0
 Thread model: posix

Cheers</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>