COMP: Wrap ESMDemonsRegistrationFunction only with matching vector dim#6591
Merged
hjmjohnson merged 1 commit intoJul 13, 2026
Conversation
The wrap file generated cross products such as ESMDemonsRegistrationFunction<Image<float,3>,Image<float,3>, Image<Vector<float,2>,3>>. Those instantiations index a 2-component displacement vector with loops bound by ImageDimension, which GCC 11.4 diagnoses as -Waggressive-loop-optimizations in itkWarpImageFilter.hxx and itkESMDemonsRegistrationFunction.hxx on the nightly dashboard, and which is undefined behavior if ever executed. Restrict the wrapped combinations to vector dimension == image dimension, matching the sibling DiffeomorphicDemonsRegistrationFilter wrapping.
Contributor
|
| Filename | Overview |
|---|---|
| Modules/Nonunit/Review/wrapping/itkESMDemonsRegistrationFunction.wrap | Generates matched image/vector dimension wrappers for ESMDemonsRegistrationFunction; no actionable issue found. |
Reviews (1): Last reviewed commit: "COMP: Wrap ESMDemonsRegistrationFunction..." | Re-trigger Greptile
thewtex
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restrict
itkESMDemonsRegistrationFunction.wrapto vector dimension == image dimension, matching the siblingDiffeomorphicDemonsRegistrationFilterwrapping. This removes the root cause of the recurring GCC 11.4 nightly-Waggressive-loop-optimizationswarnings initkWarpImageFilter.hxxanditkESMDemonsRegistrationFunction.hxx.Root cause
The wrap file generated cross products such as
ESMDemonsRegistrationFunction<Image<float,3>, Image<float,3>, Image<Vector<float,2>,3>>.Those instantiations index a 2-component displacement vector with loops bound by
ImageDimension— undefined behavior if ever executed, and provably out of boundsto GCC's unroller (
iteration 2 invokes undefined behavior). BecauseESMDemonsRegistrationFunctionholds aWarpImageFiltermember, one bad combinationwarns in both headers.
Reproduced locally with conda-forge gcc 11.4 (same as the
Ubuntu-22.04-gcc11.4-Rel-Pythonnightly): a single mismatched explicit instantiation emits exactly the four dashboard
warning sites; matched-dimension instantiations are clean.
Two earlier attempts patched the loop code instead of the instantiation: PR #6367
switched to a runtime
GetLengthbound, then commit d4a40cb reverted toImageDimensionbecause the runtime bound traded one warning for another. Neitheraddressed the mismatched instantiation, so the warning returned on the nightly.
The removed Python types (e.g.
itkESMDemonsRegistrationFunctionIF3IF3IVF23) werebroken by construction:
NumericTraits::SetLength(update, ImageDimension)cannotresize a fixed
Vector<float,2>, so any use was UB.