I was told that C and C++ have “undefined behavior”, that is, the same code might behave differently on different platforms, or using different compilers, if I use “certain constructs”.
Does the same apply to OpenCL and/or OpenGL SL?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, according to the OpenCL specification 1.1 which defines undefined behaviour in the front matter as:
For example:
CL_MEM_WRITE_ONLYinside a kernel”CL_MEM_READ_ONLYinside a kernel”buffer objects created with the same host_ptr or
overlapping host regions”
sub-buffer objects created with the same buffer object”
clEnqueueReadBufferwith other commands using the bufferclEnqueueReadBufferwhilst the buffer is mappedThere’s plenty more ways of invoking undefined behaviour from OpenCL though.
For OpenGL SL (specification) there are quite a few easy to find examples:
constthen it’s a compile time error)vertex shader returns undefined values if it is read before being written”
#pragma STDGL invariant(all)] is used after the declaration of any variables orfunctions, then the set of outputs that behave as invariant is undefined”
gl_PointSizeorgl_ClipVertex] before writing them results in undefined behavior”