[Beignet] [PATCH] utests: Add code to trigger one printf bug in nested for loops.

Zhigang Gong zhigang.gong at linux.intel.com
Wed Sep 17 18:13:32 PDT 2014


cc to Ruiling,

could you help to look into this issue?

On Wed, Sep 17, 2014 at 10:58:29AM +0800, Chuanbo Weng wrote:
> 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
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list