<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/79964>79964</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang/lib/Frontend/TextDiagnostic.cpp:1254: suspicious loop ?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dcb314
      </td>
    </tr>
</table>

<pre>
    Static analyser cppcheck says:

clang/lib/Frontend/TextDiagnostic.cpp:1254:40: error: When I==Spelling.size(), Spelling[I] is out of bounds. [stlOutOfBounds]

Source code is

    for (unsigned I = 0; I <= Spelling.size(); ++I) {
      // This line is done.
      if (isVerticalWhitespace(Spelling[I]) || I == Spelling.size()) {

The for loop line looks like it executes once too many times. Maybe better code

    for (unsigned I = 0; I < Spelling.size(); ++I) {

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycU0FvozwQ_TXDZVTk2DiEA4cQhJTDpx5afT0bM4C3jo2wqZr99StIq0ar3UP3MgzDaN57wzwVghkcUQmyAlknaomjn8tOt2KXJa3vruVTVNFoVE7Za6AZ9TTpkfQrBnUNII7AamAfUVvlBuCNNS3wppm9i-Q64M0zvcfaqMH5EI1O9TSBOO64zEAcMwbiiDTPfl6Tl5EcnkHUIOqniaw1bkiD-UnAD8AL4Cf8LIOsziBrNAH9EtH32PrFdSFFkFWI9nGJj321lUDW90Sf_DJrQu07QhPuvyAi9n5G4IfFbcvp8IwgamQgqi09rW9_oiYqBF4Br87AC4S8-hqJCLwB3uDzaAJa41Zc7Lyj9L7J9CuwCf_THI1W9mU0kcKk9Arxm-wbxgny043g31jdU7nF55E2jdb76cbFev-60nolNBHpnfQSKaB3mjB6jxflrhjNhUKK_6lrS9hSjOs1-I6-u77v7C7pStEVolAJlbuc7fdM8J1MxpIXPN_vc6EyJnqZ9bzLSHYk9E73GRVdYkrOeMZ2grED30uZSsqFEBk7SJn3pBRkjC7K2NTat0vq5yExISxU5kWxzxKrWrJh8wXnH3fNV4vM5dr_0C5DgIxZE2L4mhBNtFT-kw0wLGEy2vgl3H4MiCZZZluOMU6b0bYDGkwclzbV_rIC2LfPx8M0-x-kI_BmkxGAN5uSXwEAAP__ONoq6w">