pvr: Pad rogue_regarray_cache_key union members to avoid UB

GCC zeroes out the unreferenced parts of the union when assigning by
the smaller member, but clang doesn't. Neither is wrong, because the C
standard calls this UB; insert padding to ensure any compiler behaves
predictably.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Simon Perretta <simon.perretta@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24477>
This commit is contained in:
Matt Coster 2023-07-26 10:16:56 +01:00 committed by Marge Bot
parent e15832e6f4
commit 06c8ebaa66

View file

@ -237,6 +237,7 @@ struct rogue_regarray_cache_key {
uint32_t start_index;
enum rogue_reg_class class;
uint16_t size;
uint8_t __pad;
} PACKED;
uint64_t val;