From c981f60d374e8d5df08d4813b3f2869c8b5aca0b Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Mon, 15 Jun 2026 17:43:50 +0200 Subject: [PATCH 1/6] [minicern] Move address computation to 64 bit. kernlib was using the LOCF function to compute distances between common blocks. It shifts the numbers, but in 32 bits. On 64 bit architectures, this can lead to unreasonable values, and when taking the difference, it's either correct or wraps around to very large numbers. Due to aslr, the common blocks move around, which can crash the program at init time when the blocks are on different sides of the "wrap around" addresss. Here, the LOCF function is changed to use 64 bit integers for the address, which makes the distance computation independent of where the kernel places the common blocks. Fix #19329 --- misc/minicern/src/kernlib.f | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/misc/minicern/src/kernlib.f b/misc/minicern/src/kernlib.f index 701f776e015f9..34fd69510bfc8 100644 --- a/misc/minicern/src/kernlib.f +++ b/misc/minicern/src/kernlib.f @@ -87,6 +87,9 @@ SUBROUTINE UBUNCH (MS,MT,NCHP) *------------------------------------------------------------------------------- FUNCTION LOCF (IVAR) + IMPLICIT NONE + INTEGER :: LOCF, IVAR, NADUPW, LADUPW + INTEGER*8 :: J DIMENSION IVAR(9) PARAMETER (NADUPW=4, LADUPW=2) J = LOC(IVAR) @@ -94,6 +97,10 @@ FUNCTION LOCF (IVAR) END FUNCTION LOCFR (VAR) + IMPLICIT NONE + REAL :: VAR + INTEGER :: NADUPW, LADUPW, LOCFR + INTEGER*8 :: J DIMENSION VAR(9) PARAMETER (NADUPW=4, LADUPW=2) J = LOC(VAR) From 231fca3554e8f590d58525449b4626eff23ea932 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 16 Jun 2026 09:54:48 +0200 Subject: [PATCH 2/6] [NFC] Add link to zebra documentation. --- misc/minicern/src/zebra.f | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/minicern/src/zebra.f b/misc/minicern/src/zebra.f index dca35c7f7576a..3c1fba5ea4f50 100644 --- a/misc/minicern/src/zebra.f +++ b/misc/minicern/src/zebra.f @@ -3,6 +3,8 @@ * This file contains the zebra's package subset needed to build h2root. * It cannot be used by any zebra application because many zebra functionalities * are missing. +* See https://cds.cern.ch/record/2296399/files/zebra.pdf for explanation of the +* variables. * *------------------------------------------------------------------------------- From e3ab7504b116009afbe4484274aee729a337a167 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 16 Jun 2026 11:23:45 +0200 Subject: [PATCH 3/6] [minicern] Remove forced -O0 Minicern was switched to -O0 in the hope to reduce crashes. This workaround seems unnecessary now. --- misc/minicern/CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/misc/minicern/CMakeLists.txt b/misc/minicern/CMakeLists.txt index 66542f68ce3cb..258ae2d4e0642 100644 --- a/misc/minicern/CMakeLists.txt +++ b/misc/minicern/CMakeLists.txt @@ -12,9 +12,6 @@ ROOT_LINKER_LIBRARY(minicern *.c *.f TYPE STATIC) set_property(TARGET minicern PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(minicern ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) -# Disable optimization since it some cases was causing crashes. # Disable warnings, since what has worked for 40 years... # (see https://sft.its.cern.ch/jira/browse/ROOT-9179 for the warnings) -set_target_properties(minicern PROPERTIES COMPILE_FLAGS "-O0 -w") -# set_target_properties(minicern PROPERTIES COMPILE_FLAGS "-fsanitize=undefined -fsanitize=address") -# target_link_options(minicern BEFORE PUBLIC -fsanitize=undefined PUBLIC -fsanitize=address) +target_compile_options(minicern PRIVATE "$<$:-w>") From 32d5b7b57ca4dcc02750624b604c568519664c45 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 16 Jun 2026 13:11:45 +0200 Subject: [PATCH 4/6] Reenable Fortran on Mac 14. --- .github/workflows/root-ci-config/buildconfig/mac14.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/root-ci-config/buildconfig/mac14.txt b/.github/workflows/root-ci-config/buildconfig/mac14.txt index 1a203c9336cc5..a6c0be35ede43 100644 --- a/.github/workflows/root-ci-config/buildconfig/mac14.txt +++ b/.github/workflows/root-ci-config/buildconfig/mac14.txt @@ -23,7 +23,6 @@ builtin_xxhash=ON builtin_zstd=ON cocoa=ON davix=OFF -fortran=OFF minuit2_omp=OFF test_distrdf_dask=OFF test_distrdf_pyspark=OFF From 68cace6d2924f17aab38802e47dacfc9cf20b7ef Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Fri, 19 Jun 2026 09:14:27 +0200 Subject: [PATCH 5/6] squash! [minicern] Remove forced -O0 update Cmake --- misc/minicern/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/misc/minicern/CMakeLists.txt b/misc/minicern/CMakeLists.txt index 258ae2d4e0642..050025947b70d 100644 --- a/misc/minicern/CMakeLists.txt +++ b/misc/minicern/CMakeLists.txt @@ -15,3 +15,8 @@ target_link_libraries(minicern ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) # Disable warnings, since what has worked for 40 years... # (see https://sft.its.cern.ch/jira/browse/ROOT-9179 for the warnings) target_compile_options(minicern PRIVATE "$<$:-w>") + +# The offset computations between common blocks go wrong an arm64 with -O2. +# This is not a proper fix, but getting it right would require rewriting zebra's +# distance between common blocks logic ... +target_compile_options(minicern PUBLIC "$<$:-O0>") \ No newline at end of file From fdbfb73f3ddd12359fc2790e98bdf1456ce7038f Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Fri, 19 Jun 2026 09:14:36 +0200 Subject: [PATCH 6/6] [WIP] Second attempt for arm. --- misc/minicern/src/kernlib.f | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/minicern/src/kernlib.f b/misc/minicern/src/kernlib.f index 34fd69510bfc8..170e7e23fc765 100644 --- a/misc/minicern/src/kernlib.f +++ b/misc/minicern/src/kernlib.f @@ -88,8 +88,8 @@ SUBROUTINE UBUNCH (MS,MT,NCHP) FUNCTION LOCF (IVAR) IMPLICIT NONE - INTEGER :: LOCF, IVAR, NADUPW, LADUPW - INTEGER*8 :: J + INTEGER :: NADUPW, LADUPW + INTEGER*8 :: LOCF, IVAR, J DIMENSION IVAR(9) PARAMETER (NADUPW=4, LADUPW=2) J = LOC(IVAR)