clCreateContext crashes with invalid platform and invalid handle

This crashes in clCreateContext with the latest CUDA 3.0 Beta Driver on WinXP 32Bit.


properties[0] = CL_CONTEXT_PLATFORM;

properties[1] = 1

properties[2] = 0;

device_id =1;



1 isn’t a valid value for platform_id, or device_id.

They need to either be values retrieved with clGetPlatformIDs and clGetDeviceIDs, or platform_id can be null (implementation defined).

I am aware of this, however I expected the error CL_INVALID_PLATFORM or CL_INVALID_DEVICE and not a crash…

Ah yes, didn’t ready the topic title properly.

Agreed it should return those error message as listed in spec instead of crashing.


I noticed you have:

device_id =1;

does your compiler allow this, surely this would need some kind of type-cast, if device_id is a cl_device_id? (note: coming from a Delphi background)