[Beignet] [PATCH] utests: Add code to trigger one printf bug in nested for loops.
Chuanbo Weng
chuanbo.weng at intel.com
Tue Sep 16 19:58:29 PDT 2014
There is some incorrect result in nested for loops. The single
for loop and 1st nested for loops test get correct result, but
the 2nd nested for loops get incorrect result.
Signed-off-by: Chuanbo Weng <chuanbo.weng at intel.com>
---
kernels/test_printf.cl | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/kernels/test_printf.cl b/kernels/test_printf.cl
index 84bb478..d8010d7 100644
--- a/kernels/test_printf.cl
+++ b/kernels/test_printf.cl
@@ -31,6 +31,24 @@ test_printf(void)
printf("#### output a float to int is %d\n", f);
}
+ for(int i = 0; i < 3; i++)
+ if(x == 0 && y == 0 && z == 0)
+ printf(">>>>>> Test printf in for loop: i = %d\n", i);
+
+ if(x == 0 && y == 0 && z == 0)
+ printf("1st nested loops test:\n");
+ for(int i = 0; i < 3; i++)
+ for(int j = 0; j < 4; j++)
+ if(x == 0 && y == 0 && z == 0)
+ printf(">>>>>> Test printf in nested loops: i = %d, j = %d\n", i, j);
+
+ if(x == 0 && y == 0 && z == 0)
+ printf("2nd nested loops test:\n");
+ for(int i = 0; i < 10; i++)
+ for(int j = 0; j < 5; j++)
+ if(x == 0 && y == 0 && z == 0)
+ printf(">>>>>> Test printf in nested loops: i = %d, j = %d\n", i, j);
+
if (x == 0 && y == 0 && z == 0) {
printf("--- End to the printf test ---\n");
}
--
1.9.1
More information about the Beignet
mailing list