clover: Fix the const variant of adaptor_range::end to deal with mismatching range...
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 12 Nov 2013 19:14:20 +0000 (11:14 -0800)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 12 Nov 2013 19:52:47 +0000 (11:52 -0800)
Fixes infinite loop in find_grid_optimal_factor() in cases where the
user specifies a grid size with less dimensions than the device
supports.

Reported-by: Tom Stellard <thomas.stellard@amd.com>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
src/gallium/state_trackers/clover/util/range.hpp

index cefa5b5ad17d9367deec8dbec5751b59ec99641d..afa5f7730bf989adf094ea7e86c55800c95e1aaa 100644 (file)
@@ -269,7 +269,8 @@ namespace clover {
 
       typename super::const_iterator
       end() const {
-         return { f, tuple::map(ends(), os) };
+         return { f, tuple::map(advances_by(size()),
+                                tuple::map(begins(), os)) };
       }
 
       typename super::size_type