[Libclc-dev] Current definition of INT_MIN causes problems

Pflanzer, Moritz via Libclc-dev libclc-dev at lists.llvm.org
Thu Sep 10 03:48:26 PDT 2015


Hello,

I found out that the current definition of INT_MIN as

#define INT_MIN (-2147483648)

can cause problems because this number seems to be represented as long in the Clang compiler which leads to conversion failures. I posted a message with some more details to the llvm-dev mailing list to ask about the behaviour (http://lists.llvm.org/pipermail/llvm-dev/2015-September/090278.html).

Nevertheless, the problem could be prevented if the definition is changed to

#define INT_MIN (-2147483647 - 1)

which is represented as int. This is also the definition that the OpenCL C 1.1 standard suggests (ยง6.11.3).

Is there a particular reason why this definition is not used or do you have any concerns about changing it?

Regards,

Moritz


More information about the Libclc-dev mailing list