meson: Disable GCC's dead store elimination for memory zeroing custom new
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Tue, 19 May 2020 17:35:49 +0000 (20:35 +0300)
committerMarge Bot <eric+marge@anholt.net>
Thu, 21 May 2020 08:54:30 +0000 (08:54 +0000)
commit5500a2b7fc558217bbd4c2a966ab6fcadaed8b3b
tree5bb0673620b375e43e415cac17a101e0b2719a25
parenta3045cbc97d7417e3036ba8f1f6f5189c1254407
meson: Disable GCC's dead store elimination for memory zeroing custom new

Some classes use custom new operator which zeroes memory, however gcc does
aggressive dead-store elimination which threats all writes to the memory
before the constructor as "dead stores".

For now we disable this optimization.

The new operators in question are declared via:
 DECLARE_RZALLOC_CXX_OPERATORS
 DECLARE_LINEAR_ZALLOC_CXX_OPERATORS

The issue was found with lto builds, however there is no guarantee that
it didn't happen with ordinary ones.

CC: <mesa-stable@lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2977
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1358
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5104>
meson.build