When using arm-linux-gnueabi-gcc as a compiler it does not do the implicit conversion from cl_uint to long and causes the comparison where -1 and variables of type cl_uint to go wrong. When casting num_platforms and num_devices to long, it works.
If you use gcc -Wall -Wextra clinfo.c -o clinfo-x64 -lOpenCL -lm, you get a list of conversions, but I found these far from complete. Going to test on the arm32-compiler later.
clinfo.c: In function ‘main’:
clinfo.c:476:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (specific_platform > -1 && i != specific_platform) continue;
^~
clinfo.c:545:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (specific_device > -1 && j != specific_device) continue;
Currently have done my edits on a local machine, so can't easily create a PR right now. I'm putting this issue so others know the code does not work correctly on some compilers, and I get remembered to make that PR when there is a reply on this.
When using
arm-linux-gnueabi-gccas a compiler it does not do the implicit conversion from cl_uint to long and causes the comparison where-1and variables of typecl_uintto go wrong. When castingnum_platformsandnum_devicesto long, it works.If you use
gcc -Wall -Wextra clinfo.c -o clinfo-x64 -lOpenCL -lm, you get a list of conversions, but I found these far from complete. Going to test on the arm32-compiler later.Currently have done my edits on a local machine, so can't easily create a PR right now. I'm putting this issue so others know the code does not work correctly on some compilers, and I get remembered to make that PR when there is a reply on this.