From 06c8ebaa66b6f12b577ad1aa5e2a11628fd3735d Mon Sep 17 00:00:00 2001 From: Matt Coster Date: Wed, 26 Jul 2023 10:16:56 +0100 Subject: [PATCH] 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 Reviewed-by: Karmjit Mahil Reviewed-by: Simon Perretta Part-of: --- src/imagination/rogue/rogue.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/imagination/rogue/rogue.h b/src/imagination/rogue/rogue.h index 9cb665de5dd..1d645db3872 100644 --- a/src/imagination/rogue/rogue.h +++ b/src/imagination/rogue/rogue.h @@ -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;