From 132ce99db307e9877c2d1475221e469ba45ecc0c Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Fri, 24 Apr 2026 19:09:41 +0200 Subject: [PATCH] [core] Avoid a clang vectoriser bug. The loop vectoriser in clang-20 to clang-22 can overflow the stack, which should explain the crashes observed when mac beta moved to clang-21. Here, we instruct the vectoriser to leave the function loop untouched. https://github.com/llvm/llvm-project/issues/194008 --- core/base/src/TColorGradient.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/base/src/TColorGradient.cxx b/core/base/src/TColorGradient.cxx index 74c1f4bba761a..2b7a1af7a17bd 100644 --- a/core/base/src/TColorGradient.cxx +++ b/core/base/src/TColorGradient.cxx @@ -111,6 +111,9 @@ void TColorGradient::ResetColor(UInt_t nPoints, const Double_t *points, fColors.assign(colors, colors + nPoints * 4); Double_t sum[4] = { 0., 0., 0., 0. }; + // Clang vectoriser bug. The loop can break with -O2 -mavx2 or similar. + // https://github.com/llvm/llvm-project/issues/194008 +#pragma clang loop vectorize(disable) for (unsigned n = 0; n < fColors.size(); ++n) sum[n % 4] += fColors[n];