<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 - ArrayBoundCheckerV2 false positive if indexer has size_t type"
   href="https://bugs.llvm.org/show_bug.cgi?id=45148">45148</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ArrayBoundCheckerV2 false positive if indexer has size_t type
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>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>dcoughlin@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>benicsbalazs@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dcoughlin@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23216" name="attach_23216" title="Rewritten exploded graphs of all three functions of the example.">attachment 23216</a> <a href="attachment.cgi?id=23216&action=edit" title="Rewritten exploded graphs of all three functions of the example.">[details]</a></span>
Rewritten exploded graphs of all three functions of the example.

This bug was reported by Loïc Joly.
You can read the original discussion at the cfe-dev archives:
<a href="http://lists.llvm.org/pipermail/cfe-dev/2020-March/064783.html">http://lists.llvm.org/pipermail/cfe-dev/2020-March/064783.html</a>


The gist of this bug is demonstrated by this example:
```
// clang -cc1 -analyze -analyzer-checker=core,alpha.security.ArrayBoundV2
arrayv2.c
typedef unsigned long long size_t;
const char a[] = "aabbcc";

char f1(size_t len) {
  return a[len+1];
//       ^~~~~~~~
// arrayv2.c:7:10: warning: Out of bound memory access (access exceeds upper
limit of memory block)
}
char f2(size_t len) {
  return a[len]; // no-warning
}
char f3(int len) {
  return a[len+1]; // no-warning
}
```</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>