[2/2] utest: fix a link program error.

Submitted by Yang, Rong R on Aug. 21, 2017, 7 a.m.

Details

Message ID 1503298854-9881-2-git-send-email-rong.r.yang@intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

Yang, Rong R Aug. 21, 2017, 7 a.m.
In function cl_kernel_link, the input program and the return program
of clReleaseProgram function should not use the same program,
otherwize, after release input program, the return program will
be invalid.

Signed-off-by: Yang Rong <rong.r.yang@intel.com>
---
 utests/utest_helper.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
index 52d1714..685e185 100644
--- a/utests/utest_helper.cpp
+++ b/utests/utest_helper.cpp
@@ -360,7 +360,7 @@  cl_kernel_link(const char *file_name, const char *kernel_name, const char * link
                 file_name, kernel_name);
     const char *src = cl_file_map_begin(fm);
     const size_t sz = cl_file_map_size(fm);
-    program = clCreateProgramWithSource(ctx, 1, &src, &sz, &status);
+    cl_program input_program = clCreateProgramWithSource(ctx, 1, &src, &sz, &status);
     cl_file_map_delete(fm);
     
     if (status != CL_SUCCESS) {
@@ -369,7 +369,7 @@  cl_kernel_link(const char *file_name, const char *kernel_name, const char * link
     }
     prevFileName = file_name;
 
-    OCL_CALL (clCompileProgram, program,
+    OCL_CALL (clCompileProgram, input_program,
                                 1, &device, // num_devices & device_list
                                 NULL, // compile_options
                                 0, // num_input_headers
@@ -377,7 +377,7 @@  cl_kernel_link(const char *file_name, const char *kernel_name, const char * link
                                 NULL,
                                 NULL, NULL);
     OCL_ASSERT(status==CL_SUCCESS);
-    cl_program input_programs[1] = {program};
+    cl_program input_programs[1] = {input_program};
     program = clLinkProgram(ctx, 1, &device, link_opt, 1, input_programs, NULL, NULL, &status);
     OCL_ASSERT(program != NULL);
     OCL_ASSERT(status == CL_SUCCESS);