panfrost: fix strict-aliasing violations when packing fb ptrs
authorItalo Nicola <italonicola@collabora.com>
Fri, 17 Mar 2023 18:59:38 +0000 (15:59 -0300)
committerMarge Bot <emma+marge@anholt.net>
Wed, 22 Mar 2023 11:50:36 +0000 (11:50 +0000)
commit2362e02f297d0556fe07b7ae7ee680ca784dfc0c
tree2b30d682d9ce469a52580773ccc6d9847e4f8ebd
parentb6d5cb0d39be4882d7454e05d76e51629a409616
panfrost: fix strict-aliasing violations when packing fb ptrs

Compilers are free to make the assumption that pointers don't violate
strict aliasing. If that assumption is incorrect, as it is with the
framebuffer pointer packing code here, the job can fail.

This depends heavily on the compiler and optimization levels, so it's
hard to reproduce, but it did happen for at least two users running with
-O2 on gcc.

Fixes: 67cbbf941751 ("panfrost: Use framebuffer pointer XML")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8627
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21991>
src/gallium/drivers/panfrost/pan_cmdstream.c
src/panfrost/lib/pan_cs.c