<html>
    <head>
      <base href="http://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 --- - clang -Warray-bounds doesn't warn in some instances (where XLC and gcc do)"
   href="http://llvm.org/bugs/show_bug.cgi?id=17383">17383</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang -Warray-bounds doesn't warn in some instances (where XLC and gcc do)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sean@rogue-research.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11283" name="attach_11283" title="repro case">attachment 11283</a> <a href="attachment.cgi?id=11283&action=edit" title="repro case">[details]</a></span>
repro case

Test case attached:

----------------
#include <iostream>

class MyClass
{
private:
  int ivar[2];

public:
  void Method()
  {
  // This warns.
  this->ivar[2] = 0;

  // This warns.
  int foo[2];
  foo[2] = 0;

  // This warns.
  int tmp = this->ivar[2]; (void)tmp;

  // FAILS TO WARN
  std::cout << this->ivar[2];
  }
};
----------------

clang trunk r191092 fails to warn on the last case, where the "<<" is involved.

This is a reduced test case from VTK, which is built daily by many compilers.

XLC warns:
"/.../VTK/Rendering/Core/vtkTextMapper.cxx", line 101.53: 1540-2907 (W) The
subscript 2 is out of range. The valid range is 0 to 1.

<<a href="http://open.cdash.org/viewBuildError.php?type=1&buildid=3040120">http://open.cdash.org/viewBuildError.php?type=1&buildid=3040120</a>>


and gcc warns:
/home/kitware/Dashboards/MyTests/VTK-nightly-release-src/Rendering/Core/vtkTextMapper.cxx:
In member function 'virtual void vtkTextMapper::PrintSelf(std::ostream&,
vtkIndent)':
/home/kitware/Dashboards/MyTests/VTK-nightly-release-src/Rendering/Core/vtkTextMapper.cxx:101:54:
warning: array subscript is above array bounds [-Warray-bounds]

<<a href="http://open.cdash.org/viewBuildError.php?type=1&buildid=3040230">http://open.cdash.org/viewBuildError.php?type=1&buildid=3040230</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>