utests: fix two utest bugs.
authorZhigang Gong <zhigang.gong@intel.com>
Tue, 2 Sep 2014 02:34:33 +0000 (10:34 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Tue, 2 Sep 2014 04:42:51 +0000 (12:42 +0800)
Similar as the bug found by junyan, some events are
accessed before assigned.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: He Junyan <junyan.he@inbox.com>
utests/runtime_event.cpp
utests/runtime_marker_list.cpp

index b974f6a..f8170a3 100644 (file)
@@ -28,7 +28,7 @@ void runtime_event(void)
   locals[0] = 32;
   clEnqueueNDRangeKernel(queue, kernel, 1, NULL, globals, locals, 2, &ev[0], &ev[2]);
 
-  for (cl_uint i = 0; i != sizeof(ev) / sizeof(cl_event); ++i) {
+  for (cl_uint i = 0; i < 3; ++i) {
     clGetEventInfo(ev[i], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(status), &status, NULL);
     OCL_ASSERT(status >= CL_SUBMITTED);
   }
index fc77156..f64b1d1 100644 (file)
@@ -34,7 +34,7 @@ void runtime_marker_list(void)
 
   clEnqueueNDRangeKernel(queue, kernel, 1, NULL, globals, locals, 2, &ev[0], &ev[2]);
 
-  for (cl_uint i = 0; i != sizeof(ev) / sizeof(cl_event); ++i) {
+  for (cl_uint i = 0; i < 3; ++i) {
     clGetEventInfo(ev[i], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(status), &status, NULL);
     OCL_ASSERT(status >= CL_SUBMITTED);
   }