From 0ea2f6de5b46b8528efca07ca545e2c0aee9781c Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Thu, 2 May 2024 10:09:39 -0500 Subject: [PATCH] COMP: Fix for gcc13.2 compiler test failures Three tests fail in ITK for Release and RelWithDebInfo builds on Ubuntu 24.04 with GCC 13.2: itkGDCMLegacyMultiFrameTest (Failed) itkGDCMImageReadWriteTest_MultiFrameMRIZSpacing (Failed) itkGDCM_ComplianceTest_singlebit (Failed) (Note: Debug builds do not fail these tests) The initial review of the code did not indicate a problem, but it looks like perhaps an over-optimization that removes variables and causes the incorrect behavior to occur. The function "FindDataElement" had duplicate code from "GetDataElement" so made "FindDataElement" use the "GetDataElement" working function. --- .../DataStructureAndEncodingDefinition/gdcmDataSet.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition/gdcmDataSet.h b/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition/gdcmDataSet.h index 5f26a3dd4498..3ed85b2a9737 100644 --- a/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition/gdcmDataSet.h +++ b/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition/gdcmDataSet.h @@ -209,13 +209,9 @@ class GDCM_EXPORT DataSet // DUMB: this only search within the level of the current DataSet bool FindDataElement(const Tag &t) const { - const DataElement r(t); - //ConstIterator it = DES.find(r); - if( DES.find(r) != DES.end() ) - { - return true; - } - return false; + const auto it = GetDataElement(t); + // Return if tag is found + return it != GetDEEnd(); } // WARNING: