<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Valgrind reports error with Linux shared library in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Valgrind-reports-error-with-Linux-shared-library/m-p/964671#M2270</link>
    <description>Hello all,

  I modified the BitonicSort program to run on Linux. While the program worked correctly, it would crash when exiting so I used Valgrind to debug. I have since switched to using the C++ bindings but these problems exist in both cases. The first problem is while creating a cl::Context object I get messages about an uninitialized value being used in the function below. Fortunately the debug info was left in.

  std::vector&lt;:DEVICE&gt; devices;
  devices.push_back(thisDevice);
  thisContext = cl::Context(devices,context_properties,NULL,NULL,&amp;amp;result);
  if(result != CL_SUCCESS)
  {
    printf("ERROR: cl::Context() failed with %d\n",result);
    return -1;
  }
  printf("INFO: cl::Context() created\n");

==2875== Conditional jump or move depends on uninitialised value(s)
==2875==    at 0x6F6B2A2: Intel::OpenCL::DeviceBackend::Utils::CPUDetect::CPUDetect() (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)
==2875==    by 0x6F6B3FF: global constructors keyed to CPUDetect.cpp (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)
==2875==    by 0x76C1DF5: ??? (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)
==2875==    by 0x6F18602: ??? (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)
==2875==  Uninitialised value was created by a stack allocation
==2875==    at 0x6F6B260: Intel::OpenCL::DeviceBackend::Utils::CPUDetect::CPUDetect() (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)

The second set of errors reports the following while running cl::Program::build(). 

  program.build(devices,NULL,NULL,NULL);

==2889== Conditional jump or move depends on uninitialised value(s)
==2889==    at 0x4A091A9: __GI_strlen (mc_replace_strmem.c:404)
==2889==    by 0x307A6853E5: strdup (in /usr/lib64/libc-2.15.so)
==2889==    by 0x57C24B2: Intel::OpenCL::Utils::CPUDetect::GetCPUInfo() (in /usr/lib64/OpenCL/vendors/intel/libclang_compiler.so)
==2889==    by 0x57C2903: Intel::OpenCL::Utils::CPUDetect::GetInstance() (in /usr/lib64/OpenCL/vendors/intel/libclang_compiler.so)
==2889==    by 0x57BD078: Intel::OpenCL::ClangFE::CompileTask::PrepareArgumentList(std::list&lt;:STRING&gt; &amp;gt;&amp;amp;, std::list&lt;:STRING&gt; &amp;gt;&amp;amp;, char const*) (in /usr/lib64/OpenCL/vendors/intel/libclang_compiler.so)
==2889==    by 0x57BF059: Intel::OpenCL::ClangFE::CompileTask::Execute() (in /usr/lib64/OpenCL/vendors/intel/libclang_compiler.so)
==2889==    by 0x3B1F20F689: Intel::OpenCL::TaskExecutor::execute_command(Intel::OpenCL::TaskExecutor::ITaskBase*) (in /usr/lib64/OpenCL/vendors/intel/libtask_executor.so)
==2889==    by 0x3B1F213810: Intel::OpenCL::TaskExecutor::in_order_executor_task::execute() (in /usr/lib64/OpenCL/vendors/intel/libtask_executor.so)
==2889==    by 0x3B1F6204FB: tbb::internal::custom_scheduler&lt;:INTERNAL::INTELSCHEDULERTRAITS&gt;::local_wait_for_all(tbb::task&amp;amp;, tbb::task*) (custom_scheduler.h:441)
==2889==    by 0x3B1F61D7D8: tbb::internal::arena::process(tbb::internal::generic_scheduler&amp;amp;) (arena.cpp:91)
==2889==    by 0x3B1F61BC8A: tbb::internal::market::process(rml::job&amp;amp;) (market.cpp:385)
==2889==    by 0x3B1F6192F6: tbb::internal::rml::private_worker::run() (private_server.cpp:255)
==2889==  Uninitialised value was created by a stack allocation
==2889==    at 0x307A2148E5: _dl_runtime_resolve (in /usr/lib64/ld-2.15.so)&lt;/:INTERNAL::INTELSCHEDULERTRAITS&gt;&lt;/:STRING&gt;&lt;/:STRING&gt;&lt;/:DEVICE&gt;</description>
    <pubDate>Tue, 04 Dec 2012 22:41:10 GMT</pubDate>
    <dc:creator>A_Z_</dc:creator>
    <dc:date>2012-12-04T22:41:10Z</dc:date>
    <item>
      <title>Valgrind reports error with Linux shared library</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Valgrind-reports-error-with-Linux-shared-library/m-p/964671#M2270</link>
      <description>Hello all,

  I modified the BitonicSort program to run on Linux. While the program worked correctly, it would crash when exiting so I used Valgrind to debug. I have since switched to using the C++ bindings but these problems exist in both cases. The first problem is while creating a cl::Context object I get messages about an uninitialized value being used in the function below. Fortunately the debug info was left in.

  std::vector&lt;:DEVICE&gt; devices;
  devices.push_back(thisDevice);
  thisContext = cl::Context(devices,context_properties,NULL,NULL,&amp;amp;result);
  if(result != CL_SUCCESS)
  {
    printf("ERROR: cl::Context() failed with %d\n",result);
    return -1;
  }
  printf("INFO: cl::Context() created\n");

==2875== Conditional jump or move depends on uninitialised value(s)
==2875==    at 0x6F6B2A2: Intel::OpenCL::DeviceBackend::Utils::CPUDetect::CPUDetect() (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)
==2875==    by 0x6F6B3FF: global constructors keyed to CPUDetect.cpp (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)
==2875==    by 0x76C1DF5: ??? (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)
==2875==    by 0x6F18602: ??? (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)
==2875==  Uninitialised value was created by a stack allocation
==2875==    at 0x6F6B260: Intel::OpenCL::DeviceBackend::Utils::CPUDetect::CPUDetect() (in /usr/lib64/OpenCL/vendors/intel/libOclCpuBackEnd.so)

The second set of errors reports the following while running cl::Program::build(). 

  program.build(devices,NULL,NULL,NULL);

==2889== Conditional jump or move depends on uninitialised value(s)
==2889==    at 0x4A091A9: __GI_strlen (mc_replace_strmem.c:404)
==2889==    by 0x307A6853E5: strdup (in /usr/lib64/libc-2.15.so)
==2889==    by 0x57C24B2: Intel::OpenCL::Utils::CPUDetect::GetCPUInfo() (in /usr/lib64/OpenCL/vendors/intel/libclang_compiler.so)
==2889==    by 0x57C2903: Intel::OpenCL::Utils::CPUDetect::GetInstance() (in /usr/lib64/OpenCL/vendors/intel/libclang_compiler.so)
==2889==    by 0x57BD078: Intel::OpenCL::ClangFE::CompileTask::PrepareArgumentList(std::list&lt;:STRING&gt; &amp;gt;&amp;amp;, std::list&lt;:STRING&gt; &amp;gt;&amp;amp;, char const*) (in /usr/lib64/OpenCL/vendors/intel/libclang_compiler.so)
==2889==    by 0x57BF059: Intel::OpenCL::ClangFE::CompileTask::Execute() (in /usr/lib64/OpenCL/vendors/intel/libclang_compiler.so)
==2889==    by 0x3B1F20F689: Intel::OpenCL::TaskExecutor::execute_command(Intel::OpenCL::TaskExecutor::ITaskBase*) (in /usr/lib64/OpenCL/vendors/intel/libtask_executor.so)
==2889==    by 0x3B1F213810: Intel::OpenCL::TaskExecutor::in_order_executor_task::execute() (in /usr/lib64/OpenCL/vendors/intel/libtask_executor.so)
==2889==    by 0x3B1F6204FB: tbb::internal::custom_scheduler&lt;:INTERNAL::INTELSCHEDULERTRAITS&gt;::local_wait_for_all(tbb::task&amp;amp;, tbb::task*) (custom_scheduler.h:441)
==2889==    by 0x3B1F61D7D8: tbb::internal::arena::process(tbb::internal::generic_scheduler&amp;amp;) (arena.cpp:91)
==2889==    by 0x3B1F61BC8A: tbb::internal::market::process(rml::job&amp;amp;) (market.cpp:385)
==2889==    by 0x3B1F6192F6: tbb::internal::rml::private_worker::run() (private_server.cpp:255)
==2889==  Uninitialised value was created by a stack allocation
==2889==    at 0x307A2148E5: _dl_runtime_resolve (in /usr/lib64/ld-2.15.so)&lt;/:INTERNAL::INTELSCHEDULERTRAITS&gt;&lt;/:STRING&gt;&lt;/:STRING&gt;&lt;/:DEVICE&gt;</description>
      <pubDate>Tue, 04 Dec 2012 22:41:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Valgrind-reports-error-with-Linux-shared-library/m-p/964671#M2270</guid>
      <dc:creator>A_Z_</dc:creator>
      <dc:date>2012-12-04T22:41:10Z</dc:date>
    </item>
    <item>
      <title>Hi!</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Valgrind-reports-error-with-Linux-shared-library/m-p/964672#M2271</link>
      <description>Hi!

Could you please attach a reproducer for this issue (modified BitonicSort, as well as makefile or compilation flags).

Thanks,
Yuri</description>
      <pubDate>Mon, 24 Dec 2012 08:50:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Valgrind-reports-error-with-Linux-shared-library/m-p/964672#M2271</guid>
      <dc:creator>Yuri_K_Intel</dc:creator>
      <dc:date>2012-12-24T08:50:06Z</dc:date>
    </item>
    <item>
      <title>Compiled with  'clang++ -g</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Valgrind-reports-error-with-Linux-shared-library/m-p/964673#M2272</link>
      <description>Compiled with  'clang++ -g -lOpenCL main.cpp'
Run with 'valgrind ./a.out'

I posted a cleaned-up single-file version. For me this crashes on exit, but doesn't when run through valgrind. Lines 136 and 167 have the function calls of interest. Algorithm otherwise executes correctly on a Core 2 Duo(P8400).

Running on Fedora 17
clang version 3.3 (trunk 171050), although it happens with gcc as well</description>
      <pubDate>Thu, 27 Dec 2012 18:00:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Valgrind-reports-error-with-Linux-shared-library/m-p/964673#M2272</guid>
      <dc:creator>A_Z_</dc:creator>
      <dc:date>2012-12-27T18:00:18Z</dc:date>
    </item>
  </channel>
</rss>

