From 3bf10012e0a8e327b94cc1af4bccf6cc32f95786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 26 Jul 2022 11:00:11 +0300 Subject: [PATCH] MDEV-28762: Fixup for clang Unlike GCC, clang could optimize away alloca() and thus the ALLOCATE_MEM_ON_STACK() instrumentation. To make it harder, let us invoke a non-inline function on the entire allocated buffer. --- sql/item_jsonfunc.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 2fa6b19d95f..c0f063639bc 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -31,9 +31,8 @@ #define ALLOCATE_MEM_ON_STACK(A) do \ { \ uchar *array= (uchar*)alloca(A); \ - array[0]= 1; \ - array[0]++; \ - array[0] ? array[0]++ : array[0]--; \ + bzero(array, A); \ + my_checksum(0, array, A); \ } while(0) /*