radv: fix strict aliasing violation
authorGrigori Goronzy <greg@chown.ath.cx>
Tue, 11 Oct 2016 22:47:20 +0000 (00:47 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 11 Oct 2016 23:00:22 +0000 (09:00 +1000)
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_pipeline_cache.c

index 032a7e460409665a8b233fc94cd6cb42c143e25d..85a2b6dc918787cfb3f7d676003d9ef9fe172858 100644 (file)
 #include "ac_nir_to_llvm.h"
 
 struct cache_entry {
-       unsigned char sha1[20];
+       union {
+               unsigned char sha1[20];
+               uint32_t sha1_dw[5];
+       };
        uint32_t code_size;
        struct ac_shader_variant_info variant_info;
        struct ac_shader_config config;
@@ -185,7 +188,7 @@ radv_pipeline_cache_set_entry(struct radv_pipeline_cache *cache,
                              struct cache_entry *entry)
 {
        const uint32_t mask = cache->table_size - 1;
-       const uint32_t start = (*(uint32_t *) entry->sha1);
+       const uint32_t start = entry->sha1_dw[0];
 
        /* We'll always be able to insert when we get here. */
        assert(cache->kernel_count < cache->table_size / 2);