[Beignet] [PATCH 06/12] utest: init uninitialized local variables.

xionghu.luo at intel.com xionghu.luo at intel.com
Thu May 5 16:11:49 UTC 2016


From: Luo Xionghu <xionghu.luo at intel.com>

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 utests/compiler_array1.cpp                     | 2 +-
 utests/compiler_assignment_operation_in_if.cpp | 2 +-
 utests/enqueue_copy_buf_unaligned.cpp          | 2 +-
 utests/utest.cpp                               | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/utests/compiler_array1.cpp b/utests/compiler_array1.cpp
index fe1ecec..70ff049 100644
--- a/utests/compiler_array1.cpp
+++ b/utests/compiler_array1.cpp
@@ -3,7 +3,7 @@
 static void cpu(int global_id, int *src, int *dst) {
   int final[16];
   for (int i = 0; i < 16; ++i) {
-    int array[16];
+    int array[16] = {0};
     for (int j = 0; j < src[0]; ++j)
       array[j] = 1+src[0];
     for (int j = src[0]; j < 16; ++j)
diff --git a/utests/compiler_assignment_operation_in_if.cpp b/utests/compiler_assignment_operation_in_if.cpp
index 676c222..65f8853 100644
--- a/utests/compiler_assignment_operation_in_if.cpp
+++ b/utests/compiler_assignment_operation_in_if.cpp
@@ -18,7 +18,7 @@ static void cpu(int gidx, int *dst) {
 
 void compiler_assignment_operation_in_if(void){
   const size_t n = 16;
-  int cpu_dst[16];
+  int cpu_dst[16] = {0};
 	
   // Setup kernel and buffers
   OCL_CREATE_KERNEL("compiler_assignment_operation_in_if");
diff --git a/utests/enqueue_copy_buf_unaligned.cpp b/utests/enqueue_copy_buf_unaligned.cpp
index e1bd0aa..f501d29 100644
--- a/utests/enqueue_copy_buf_unaligned.cpp
+++ b/utests/enqueue_copy_buf_unaligned.cpp
@@ -77,7 +77,7 @@ void enqueue_copy_buf_unaligned(void)
     size_t i;
     size_t j;
     const size_t sz = 1024;
-    int offset = 0;
+    unsigned int offset = 0;
 
     OCL_CREATE_BUFFER(buf[0], 0, sz * sizeof(char), NULL);
     OCL_CREATE_BUFFER(buf[1], 0, sz * sizeof(char), NULL);
diff --git a/utests/utest.cpp b/utests/utest.cpp
index 3dc5afd..6d25db1 100644
--- a/utests/utest.cpp
+++ b/utests/utest.cpp
@@ -69,7 +69,7 @@ void runSummaryAtExit(void) {
 
 void signalHandler( int signum )
 {
-  const char* name = NULL;
+  const char* name = "";
 
   signalMap arr[] = {
     {"SIGILL",  SIGILL},
-- 
2.1.4



More information about the Beignet mailing list