From 4fa62684698ecb2e8f9271d3a942b860c7772b83 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Fri, 24 Apr 2026 19:09:41 +0200 Subject: [PATCH 1/2] [core] Disable one loop vectorisation to avoid a clang 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 affected loop untouched. https://github.com/llvm/llvm-project/issues/194008 Fix #21367 (cherry picked from commit 5a9ddba74cbc9aee37c157967a5d8d7327fed497) --- core/base/src/TColorGradient.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/base/src/TColorGradient.cxx b/core/base/src/TColorGradient.cxx index 74c1f4bba761a..bc53c419b9700 100644 --- a/core/base/src/TColorGradient.cxx +++ b/core/base/src/TColorGradient.cxx @@ -111,6 +111,12 @@ void TColorGradient::ResetColor(UInt_t nPoints, const Double_t *points, fColors.assign(colors, colors + nPoints * 4); Double_t sum[4] = { 0., 0., 0., 0. }; +#ifdef __clang__ + // Clang vectoriser bug (confirmed for clang 20 - 22) + // https://github.com/llvm/llvm-project/issues/194008 + // The store in the loop can smash the stack with e.g. -O2 -mavx2. +#pragma clang loop vectorize(disable) +#endif for (unsigned n = 0; n < fColors.size(); ++n) sum[n % 4] += fColors[n]; From cefbdf39219e8aecda8701ebe30e8a61ec4e768d Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Mon, 27 Apr 2026 17:43:12 +0200 Subject: [PATCH 2/2] Revert "Disable the gl gradient tutorials on mac beta." This reverts commit 60c321b83f37c8dd17678a560ecd7f414256a761. The underlying issue was fixed in the previous commit. --- tutorials/CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tutorials/CMakeLists.txt b/tutorials/CMakeLists.txt index 568ef9662e338..c3fa6ca37c95c 100644 --- a/tutorials/CMakeLists.txt +++ b/tutorials/CMakeLists.txt @@ -743,13 +743,6 @@ foreach(t ${tutorials}) if(${t} IN_LIST multithreaded) set_tests_properties(tutorial-${tname} PROPERTIES PROCESSORS ${NProcessors}) endif() - - if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER_EQUAL 25.4 AND tname MATCHES "gl-.*grad") - # ROOT-21367 - # On mac beta, there is a stack corruption (suspected to be a compiler bug) that may fail these tests - set_tests_properties(tutorial-${tname} PROPERTIES DISABLED True) - message(NOTICE "Disabling tutorial ${tname} for mac beta") - endif() endforeach() #---Loop over all MPI tutorials and define the corresponding test---------