[FunctionAttrs] Fix an iterator wraparound bug
authorSanjoy Das <sanjoy@playingwithpointers.com>
Sat, 7 Nov 2015 01:55:53 +0000 (01:55 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Sat, 7 Nov 2015 01:55:53 +0000 (01:55 +0000)
commitd044355f2d319b2003186187aabe2d0ed6e63684
tree84dad58fc06c2f0139c7d75bb461b13d64ebaff9
parentde9bf0f80e8262b0eae2e826a35dde0a346391e4
[FunctionAttrs] Fix an iterator wraparound bug

Summary:
This change fixes an iterator wraparound bug in
`determinePointerReadAttrs`.

Ideally, ++'ing off the `end()` of an iplist should result in a failed
assert, but currently iplist seems to silently wrap to the head of the
list on `end()++`.  This is why the bad behavior is difficult to
demonstrate.

Reviewers: chandlerc, reames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D14350

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252386 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/FunctionAttrs.cpp
test/Transforms/FunctionAttrs/out-of-bounds-iterator-bug.ll [new file with mode: 0644]