Khronos Public Bugzilla
Bug 246 - cl.hpp: Bugs in vector iterator class lead to endless loop
Summary: cl.hpp: Bugs in vector iterator class lead to endless loop
Alias: None
Product: OpenCL
Classification: Unclassified
Component: Header Files (show other bugs)
Version: 1.0
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Benedict Gaster
QA Contact: OpenCL Working Group
Depends on:
Reported: 2009-12-18 06:15 PST by Boris Bierbaum
Modified: 2013-07-23 05:35 PDT (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Boris Bierbaum 2009-12-18 06:15:31 PST

I think I've found two small bugs in the vector iterator class. Please try something like:

cl::vector<int> v;

v.push_back(1); v.push_back(2);

for( cl::vector<int>::iterator it = v.begin(); it != v.end(); it++ )
  std::cout << *it;

This ends up in an infinite loop, because the implementation of operator+= (and operator -=) has been erroneously written as operator++ in line 719 (729) of cl.hpp. Also, if you correct this, you'll find out that there's no postfix operator ++ defined.

This applies to cl.hpp from October 20, 2009.

Other than that, I'm happy with the bindings so far. :-)

Best regards
Comment 1 Benedict Gaster 2009-12-18 15:25:21 PST
Assigning to me.

I'm actually at the airport about to go on vacation and so I will fix this, along with a number of other changes, as soon as I'm back.
Comment 2 Bruce Merry 2013-07-23 05:35:51 PDT
I'm going to close this because it appears to be fixed, although it also seems that at the moment building with __NO_STD_VECTOR doesn't work (I'll open a separate bug for that in the internal bugzilla).