Khronos Public Bugzilla

Bug 246

Summary: cl.hpp: Bugs in vector iterator class lead to endless loop
Product: OpenCL Reporter: Boris Bierbaum <bierbaum>
Component: Header FilesAssignee: Benedict Gaster <bgaster>
Status: NEW --- QA Contact: OpenCL Working Group <opencl>
Severity: normal    
Priority: P3 CC: bgaster, sschuberth
Version: 1.0   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Boris Bierbaum 2009-12-18 06:15:31 PST
Hi,

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
Boris
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.