From 9eb288e54cb6c2684ad85f73a808b5a3a34be7a3 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Wed, 18 Mar 2026 07:57:38 -0500 Subject: [PATCH] COMP: Suppress GCC -Waggressive-loop-optimizations false positive GCC 11.4 emits "iteration 2 invokes undefined behavior" warnings for template-parameterized loops over FixedArray-based types in itkWarpImageFilter.hxx and itkESMDemonsRegistrationFunction.hxx. These are false positives: the loop bound (ImageDimension) matches the array size, but GCC's optimizer cannot prove this across complex template instantiations. Suppress via CTEST_CUSTOM_WARNING_EXCEPTION since ITK does not use #pragma GCC diagnostic anywhere in the codebase. CDash builds: 11129866 (Ubuntu-22.04-gcc11.4-Rel-Python) Co-Authored-By: Claude Opus 4.6 --- CMake/CTestCustom.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index c775cccdbbf..ae4b689276b 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -129,6 +129,9 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION # ignore -Wunused-template warnings in third party DoubleConversion. ".*Modules/ThirdParty/DoubleConversion/.*warning:.*Wunused-template" + # GCC false positive: template-parameterized loops over FixedArray-based types + "warning:.*iteration.*invokes undefined behavior.*-Waggressive-loop-optimizations" + # ignore some third party warnings ".*Modules/ThirdParty/.*warning:.*Wzero-as-null-pointer-constant" ".*Modules/ThirdParty/Eigen3/.*warning:.*"