svga: Fix a strict-aliasing violation in shader dumper
authorEdward O'Callaghan <funfunctor@folklore1984.net>
Tue, 6 Dec 2016 00:28:56 +0000 (11:28 +1100)
committerEdward O'Callaghan <funfunctor@folklore1984.net>
Wed, 21 Dec 2016 04:00:21 +0000 (15:00 +1100)
commit8801734da701d95608e39d829e0a31a191ee68f2
tree1ca2b2df98ab04d6fd29db8b5f102300f17ea26a
parente827d9175675aaa6cfc0b981e2a80685fb7b3a74
svga: Fix a strict-aliasing violation in shader dumper

As per the C spec, it is illegal to alias pointers to different
types. This results in undefined behaviour after optimization
passes, resulting in very subtle bugs that happen only on a
full moon..

Use a memcpy() as a well defined coercion between the isomorphic
bit-field interpretations of memory.

V.2: Use C99 compat STATIC_ASSERT() over C11 static_assert().

Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
src/gallium/drivers/svga/svgadump/svga_shader_dump.c