broadcom/vc4: Fix aliasing issue
authorStefan Schake <stschake@gmail.com>
Fri, 20 Oct 2017 14:16:44 +0000 (16:16 +0200)
committerEric Anholt <eric@anholt.net>
Sat, 21 Oct 2017 00:09:35 +0000 (17:09 -0700)
This was causing Android clang version 3.8.256229 to miscompile,
presumably due to strict aliasing.

Fixes: 14dc281c1332 ("vc4: Enforce one-uniform-per-instruction after optimization.")
src/gallium/drivers/vc4/vc4_qir_lower_uniforms.c

index 9ecfe65211e981b44daa8f635451ab1ff1084bf3..ad19f06d31b98b3ae3134cb603455792ac4e83e5 100644 (file)
@@ -66,7 +66,7 @@ remove_uniform(struct hash_table *ht, struct qreg reg)
 
         entry = _mesa_hash_table_search(ht, key);
         assert(entry);
-        entry->data--;
+        entry->data = (void *)(((uintptr_t) entry->data) - 1);
         if (entry->data == NULL)
                 _mesa_hash_table_remove(ht, entry);
 }