InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.47k stars 686 forks source link

BUG: Initialize miscellaneous local variables #5166

Closed jhlegarreta closed 2 weeks ago

jhlegarreta commented 2 weeks ago

Initialize miscellaneous local variables to avoid undefined behavior.

Fixes:

Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx:308:18:
warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
  308 |         point[j] += displacement[j];
      |                  ^

and

Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx:338:18:
warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
  338 |         point[j] += displacement[j];
      |

and

Modules/Registration/PDEDeformable/include/itkESMDemonsRegistrationFunction.hxx:331:22:
warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
  331 |       mappedPoint[j] += it.GetCenterPixel()[j];
      |

and

Modules/Registration/PDEDeformable/include/itkESMDemonsRegistrationFunction.hxx:383:19:
warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
  383 |         update[j] = factor * usedGradientTimes2[j];
      |

raised for example in: https://open.cdash.org/viewBuildError.php?type=1&buildid=10154210

PR Checklist

jhlegarreta commented 2 weeks ago

I am not sure this will fix the issue, though.

jhlegarreta commented 2 weeks ago

Issues persist :sob:: https://open.cdash.org/viewBuildError.php?type=1&buildid=10167654