From 6461dfcb55739716120f6efeaa974d218b1fb307 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Tue, 11 Mar 2025 23:41:55 +0100 Subject: [PATCH 1/3] LArClusterRec: Avoid some spurious FPEs with clang. Tell clang to optimize assuming that FP operations may trap. --- LArCalorimeter/LArClusterRec/CMakeLists.txt | 4 ++-- .../LArClusterRec/src/LArClusterCollisionTimeAlg.cxx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/LArCalorimeter/LArClusterRec/CMakeLists.txt b/LArCalorimeter/LArClusterRec/CMakeLists.txt index ee7b25601838..ff3082b94f7d 100644 --- a/LArCalorimeter/LArClusterRec/CMakeLists.txt +++ b/LArCalorimeter/LArClusterRec/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( LArClusterRec ) @@ -7,7 +7,7 @@ atlas_subdir( LArClusterRec ) atlas_add_component( LArClusterRec src/*.cxx src/components/*.cxx - LINK_LIBRARIES CaloEvent AthenaBaseComps xAODCaloEvent LArIdentifier LArRecEvent LArCablingLib AthContainers Identifier LArRawEvent ) + LINK_LIBRARIES CaloEvent AthenaBaseComps xAODCaloEvent LArIdentifier LArRecEvent LArCablingLib AthContainers Identifier LArRawEvent CxxUtils ) # Install files from the package: diff --git a/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx b/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx index 5a942a68030c..75821983e6d7 100644 --- a/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx +++ b/LArCalorimeter/LArClusterRec/src/LArClusterCollisionTimeAlg.cxx @@ -1,8 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #include "LArClusterRec/LArClusterCollisionTimeAlg.h" +#include "CxxUtils/trapping_fp.h" #include <algorithm> @@ -35,6 +36,9 @@ LArClusterCollisionTimeAlg::perSide_t LArClusterCollisionTimeAlg::analyseCluster result.nClusters=std::min(m_maxClusters.value(),clusters.size()); if (result.nClusters>0) { + // Tell clang to optimize assuming that FP operations may trap. + CXXUTILS_TRAPPING_FP; + for (size_t i=0;i<result.nClusters;++i) { const xAOD::CaloCluster* clu=clusters[i]; result.time+=clu->time(); -- GitLab From 18b4dbb8141c95e9164de9356a980585d8154849 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Tue, 11 Mar 2025 23:40:09 +0100 Subject: [PATCH 2/3] TRTMonitoringRun3: Avoid some spurious FPEs with clang. Tell clang to optimize assuming that FP operations may trap. --- .../InDetMonitoring/TRTMonitoringRun3/CMakeLists.txt | 4 ++-- .../TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/CMakeLists.txt b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/CMakeLists.txt index fae392b6ccdf..e94e8522b36b 100644 --- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TRTMonitoringRun3 ) @@ -7,7 +7,7 @@ atlas_subdir( TRTMonitoringRun3 ) atlas_add_component( TRTMonitoringRun3 src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthContainers AthenaMonitoringKernelLib AthenaMonitoringLib AtlasDetDescr CommissionEvent EventPrimitives GaudiKernel InDetByteStreamErrors InDetConditionsSummaryService InDetIdentifier InDetRIO_OnTrack InDetRawData InDetTrackSelectionToolLib StoreGateLib TRT_ConditionsServicesLib TRT_DriftFunctionToolLib TRT_ReadoutGeometry TrkToolInterfaces TrkTrack TrkTrackSummary xAODEventInfo xAODTrigger ) + LINK_LIBRARIES AthContainers AthenaMonitoringKernelLib AthenaMonitoringLib AtlasDetDescr CommissionEvent EventPrimitives GaudiKernel InDetByteStreamErrors InDetConditionsSummaryService InDetIdentifier InDetRIO_OnTrack InDetRawData InDetTrackSelectionToolLib StoreGateLib TRT_ConditionsServicesLib TRT_DriftFunctionToolLib TRT_ReadoutGeometry TrkToolInterfaces TrkTrack TrkTrackSummary xAODEventInfo xAODTrigger CxxUtils ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx index be1117f4c0bf..b8a77c15f87d 100644 --- a/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx +++ b/InnerDetector/InDetMonitoring/TRTMonitoringRun3/src/TRTMonitoringRun3RAW_Alg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #define FILLEVENTNORMALIZATION(NBINS, MIN, WIDTH, VALUE, VARPASSED, VAR, HISTGROUP) \ @@ -30,6 +30,7 @@ for (int i = 1; i <= NBINS; i++) \ #include "InDetConditionsSummaryService/IInDetConditionsSvc.h" #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "CxxUtils/trapping_fp.h" #include <sstream> #include <iomanip> @@ -1560,6 +1561,8 @@ StatusCode TRTMonitoringRun3RAW_Alg::fillTRTRDOs(const EventContext& ctx, if (nclass >= 0) { if (ibe == 0) { + // Tell clang to optimize assuming that FP operations may trap. + CXXUTILS_TRAPPING_FP; float occLL = float(moduleHits_B[modulenum_tmp]) / float(numberOfStrawsMod[nclass]); float occHL = float(HLmoduleHits_B[modulenum_tmp]) / float(numberOfStrawsMod[nclass]); AvgLLOcc_side_x = i - (32 * nclass); -- GitLab From 95b9f705873f0352950d97c43e6a1f5c00acd51f Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Tue, 11 Mar 2025 23:38:20 +0100 Subject: [PATCH 3/3] tauRecTools: Avoid some spurious FPEs with clang. Tell clang to optimize assuming that FP operations may trap. --- Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx | 5 ++++- .../tauRecTools/Root/TauSubstructureVariables.cxx | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx index f5ffa20cefc4..021501ffd385 100644 --- a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ // local include(s) @@ -8,6 +8,7 @@ #include "AsgDataHandles/ReadHandle.h" #include "AsgDataHandles/ReadDecorHandle.h" +#include "CxxUtils/trapping_fp.h" #define GeV 1000 @@ -32,6 +33,8 @@ StatusCode MvaTESVariableDecorator::initialize() { StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const { + // Tell clang to optimize assuming that FP operations may trap. + CXXUTILS_TRAPPING_FP; int mu = 0; SG::ReadDecorHandle<xAOD::EventInfo, float> eventInfoDecorHandle( m_aveIntPerXKey ); diff --git a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx index 2d9150989064..cadbc5bb15e6 100644 --- a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx +++ b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ //********************************************************************// @@ -14,6 +14,7 @@ #include "xAODJet/Jet.h" #include "xAODTau/TauJet.h" +#include "CxxUtils/trapping_fp.h" #include "tauRecTools/CaloClusterVariables.h" #include "tauRecTools/TauSubstructureVariables.h" @@ -138,6 +139,9 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& tau) const { float HADEnergy(0.); for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList) { + // Tell clang to optimize assuming that FP operations may trap. + CXXUTILS_TRAPPING_FP; + // It is at EM/LC scale for EM/LC seed jets float clEnergy = vertexedCluster.e(); -- GitLab