[LLVMdev] Possible LiveInterval Bug

David Greene dag at cray.com
Wed Jan 30 10:05:11 PST 2008


On Wednesday 30 January 2008 02:02, Evan Cheng wrote:
> AFAIK std::upper_bound() would not return end(), right?

Yes, it can return end().  In fact that's exactly what I'm seeing.
std::upper_bound is just binary search and returns where
the element should be inserted to retain ordering.  So for
example, if my iterator range is over:

1 2 3 4 5

and I call std::upper_bound(begin(), end(), 6), it's going to
return end() because that's the position before which 6
should be inserted to maintain ordering.

I did find a bug in other parts of my code that made this
paritcular problem go away, but if end() is not expected here
we should document that with an assert.  Otherwise we 
should check for it and act appropriately (I don't know what
that would be in this case).

                                       -Dave



More information about the llvm-dev mailing list