[Libclc-dev] Current definition of INT_MIN causes problems
Aaron Watry via Libclc-dev
libclc-dev at lists.llvm.org
Thu Sep 10 06:00:57 PDT 2015
On Thu, Sep 10, 2015, 5:48 AM Pflanzer, Moritz via Libclc-dev <
libclc-dev at lists.llvm.org> wrote:
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://
<http://lists.llvm.org/pipermail/llvm-dev/2015-September/090278.html>
lists.llvm.org
<http://lists.llvm.org/pipermail/llvm-dev/2015-September/090278.html>/
<http://lists.llvm.org/pipermail/llvm-dev/2015-September/090278.html>
pipermail
<http://lists.llvm.org/pipermail/llvm-dev/2015-September/090278.html>/
<http://lists.llvm.org/pipermail/llvm-dev/2015-September/090278.html>
llvm-dev
<http://lists.llvm.org/pipermail/llvm-dev/2015-September/090278.html>
/2015-September/090278.html
<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?
Sounds reasonable to me.
I'll try to check the other definitions later and see if I have time to
prep a patch/tests.
--Aaron
Regards,
Moritz
_______________________________________________
Libclc-dev mailing list
Libclc-dev at lists.llvm.org
http:// <http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>
lists.llvm.org <http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>/
<http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>cgi-bin
<http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>/mailman/
<http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>listinfo
<http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>/
<http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>libclc-dev
<http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20150910/cb2b13a9/attachment.html>
More information about the Libclc-dev
mailing list