[gamecode] Document the tests that fail under clang

The tests fail due to differences in how clang and gcc treat floating
point to unsigned integral type conversions when the values overflow. It
wouldn't be so bad if clang was consistent with conversions to 32-bit
unsigned integers, like it seems to be with conversion to 64-bit
unsigned integers.

With this, the "get QF building with clang" mini-project is done and I
won't have to panic when someone comes to me and asks if it will work.
At worst, there'll be a little bit-rot.
This commit is contained in:
Bill Currie 2022-03-31 14:47:04 +09:00
parent 020ada9fb1
commit 14ad364e17
2 changed files with 14 additions and 0 deletions

View file

@ -25,6 +25,14 @@ static pr_ivec4_t uint_conv_init[] = {
{ 0, 0, 0, 0},
};
/* Note that these tests (specifically 1, 3a and 3b) fail when compiled with
* clang and optimzing due to difference between clang and gcc, and more
* interestingly, within clang itself: with optimization enabled, the entries
* marked with "undef?" produce 0x80000000 instead of 0, but with optimization
* disabled, the expected 0 is produced.
* Inspecting the results, it seems that clang sets negative floats and doubles
* to 0 when casting to unsigned long, but not consistently.
*/
static pr_ivec4_t uint_conv_expect[] = {
{ 5, -5, 0x80000000, 0x7fffffff}, //int
{ 0x3fc00000, 0xbfc00000, 0x7149f2ca, 0xf149f2ca}, //float

View file

@ -33,6 +33,12 @@ static pr_ivec4_t ulong_conv_init[] = {
{ 0, 0, 0, 0},
};
/* Note that these tests fail when compiled with clang due to difference
* between clang and gcc. However, unlike test-conv4, the failure is
* consistent between optimized and unoptimized: all tests fail either way.
* Inspecting the results, it seems that clang sets negative floats and doubles
* to 0 when casting to unsigned long.
*/
static pr_ivec4_t ulong_conv_expect[] = {
{ 5, -5, 0x80000000, 0x7fffffff}, //int
{ 0x3fc00000, 0xbfc00000, 0x7149f2ca, 0xf149f2ca}, //float