<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - No warning when dereferencing pointers within a (fixed-size) array"
   href="https://bugs.llvm.org/show_bug.cgi?id=52343">52343</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>No warning when dereferencing pointers within a (fixed-size) array
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>eyalroz1@gmx.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following two functions:

void foo() {
    int *as[2];
    *(as[0])=1;
}

void bar() {
    int i = 0;
    int *as[2];
    for(i=0;i<1;i++)
    {
        *(as[i])=i;
    }
}

for both of them, a warning should be issued about the dereferencing of an
uninitialized pointer. clang does not issue a warning on any of them when
compiling with -Wall.

See this on GodBolt: <a href="https://godbolt.org/z/e98GW679v">https://godbolt.org/z/e98GW679v</a>

Related GCC bug (which does issue a warning for the first function):
<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102996">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102996</a></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>