<div dir="ltr"><div><div>Note: I've sent some updated piglit tests to that list, which can be reviewed here:<br><a href="http://lists.freedesktop.org/archives/piglit/2015-September/017065.html">http://lists.freedesktop.org/archives/piglit/2015-September/017065.html</a><br><br></div>I verified that each of those individual tests failed with a compile error before the changes in this patch were made, and then I fixed each error individually with a retesting step between fixing each definition.<br><br></div>--Aaron<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 10, 2015 at 10:14 AM, Aaron Watry <span dir="ltr"><<a href="mailto:awatry@gmail.com" target="_blank">awatry@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The values for the char/short/integer/long minimums were declared with their actual values, not the definitions from the CL spec (v1.1).  As a result, <a href="tel:%28-2147483648" value="+12147483648">(-2147483648</a>) was actually being treated as a long by the compiler, not an int, which caused issues when trying to add/subtract that value from a vector.<br>
<br>
Update the definitions to use the values declared by the spec, and also add explicit casts for the char/short minimums so that the compiler actually treats them as shorts/chars. Without those casts, they actually end up stored as integers.<br>
<br>
The compiler can sign extend the values if it needs to conver the char->short or short->int.<br>
<br>
Reported-by: Moritz Pflanzer <<a href="mailto:moritz.pflanzer14@imperial.ac.uk">moritz.pflanzer14@imperial.ac.uk</a>><br>
CC: Moritz Pflanzer <<a href="mailto:moritz.pflanzer14@imperial.ac.uk">moritz.pflanzer14@imperial.ac.uk</a>><br>
Signed-off-by: Aaron Watry <<a href="mailto:awatry@gmail.com">awatry@gmail.com</a>><br>
---<br>
 generic/include/clc/integer/definitions.h | 12 ++++++------<br>
 1 file changed, 6 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/generic/include/clc/integer/definitions.h b/generic/include/clc/integer/definitions.h<br>
index a407974..505002f 100644<br>
--- a/generic/include/clc/integer/definitions.h<br>
+++ b/generic/include/clc/integer/definitions.h<br>
@@ -1,14 +1,14 @@<br>
 #define CHAR_BIT 8<br>
 #define INT_MAX 2147483647<br>
-#define INT_MIN -2147483648<br>
+#define INT_MIN (-2147483647 - 1)<br>
 #define LONG_MAX  0x7fffffffffffffffL<br>
-#define LONG_MIN -0x8000000000000000L<br>
+#define LONG_MIN (-0x7fffffffffffffffL - 1)<br>
+#define CHAR_MAX SCHAR_MAX<br>
+#define CHAR_MIN SCHAR_MIN<br>
 #define SCHAR_MAX 127<br>
-#define SCHAR_MIN -128<br>
-#define CHAR_MAX 127<br>
-#define CHAR_MIN -128<br>
+#define SCHAR_MIN ((char)(-127 - 1))<br>
 #define SHRT_MAX 32767<br>
-#define SHRT_MIN -32768<br>
+#define SHRT_MIN ((short)(-32767 - 1))<br>
 #define UCHAR_MAX 255<br>
 #define USHRT_MAX 65535<br>
 #define UINT_MAX 0xffffffff<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.4<br>
<br>
</font></span></blockquote></div><br></div>