From f8b0b17634362730d1cc8eddf5b41e73d75e4f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 26 Sep 2022 16:05:31 +0200 Subject: [PATCH] MethodBind: Silence GCC `-Wmaybe-uninitialized` caused by UBSAN A priori this doesn't appear to be an actual bug, but a known consequence of using UBSAN. We silence this one to still have the possibility to get more warnings raised by UBSAN, in case they are useful. Works around and closes #66343. --- core/object/method_bind.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/object/method_bind.h b/core/object/method_bind.h index d60550c8992..0d3e40f7094 100644 --- a/core/object/method_bind.h +++ b/core/object/method_bind.h @@ -241,9 +241,17 @@ class MethodBindVarArgTR : public MethodBindVarArgBase, friend class MethodBindVarArgBase, T, R, true>; public: +#if defined(SANITIZERS_ENABLED) && defined(__GNUC__) && !defined(__clang__) + // Workaround GH-66343 raised only with UBSAN, seems to be a false positive. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override { return (static_cast(p_object)->*MethodBindVarArgBase, T, R, true>::method)(p_args, p_arg_count, r_error); } +#if defined(SANITIZERS_ENABLED) && defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif MethodBindVarArgTR( R (T::*p_method)(const Variant **, int, Callable::CallError &),