Module: Mesa Branch: staging/20.0 Commit: 5ec4368b367d1f4da4a24891b497ca3c41522da9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ec4368b367d1f4da4a24891b497ca3c41522da9
Author: Danylo Piliaiev <danylo.pilia...@globallogic.com> Date: Tue May 19 20:35:49 2020 +0300 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-sta...@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.pilia...@globallogic.com> Reviewed-by: Marek Olšák <marek.ol...@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5104> (cherry picked from commit 5500a2b7fc558217bbd4c2a966ab6fcadaed8b3b) --- .pick_status.json | 2 +- meson.build | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index a538b532ff5..4a5751384ed 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2659,7 +2659,7 @@ "description": "meson: Disable GCC's dead store elimination for memory zeroing custom new", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/meson.build b/meson.build index ef4bdc2cb02..32e7e3f4374 100644 --- a/meson.build +++ b/meson.build @@ -972,6 +972,11 @@ else '-fno-math-errno', '-fno-trapping-math', '-Qunused-arguments', + # 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. + '-flifetime-dse=1', ] # MinGW chokes on format specifiers and I can't get it all working if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows') _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit