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.37k stars 660 forks source link

Address GCC 13.2 compilation issues #4607

Closed hjmjohnson closed 1 month ago

hjmjohnson commented 2 months ago

Description

The forth coming LTR Ubuntu 24.04 (on April 25, 2024) is distributed with GCC 13.2 compiler.

ITK should build cleanly with this new standard compiler.

Steps to Reproduce

  1. clone itk
  2. build in release mode (with Examples turned on)

Expected behavior

no build warnings no failing tests

Actual behavior

3 test failures

    1012 - itkGDCMLegacyMultiFrameTest (Failed)
    1021 - itkGDCMImageReadWriteTest_MultiFrameMRIZSpacing (Failed)
    1023 - itkGDCM_ComplianceTest_singlebit (Failed)

199+ compiler warnings

Reproducibility

all the time

Versions

ITK master branch on 2024-04-23

git rev-parse --short HEAD

3235b3675c

Environment

Ubuntu 24.04 GCC 13.2 compiler

Additional Information

242 |   alignas(SizeValueType) SizeValueType m_InternalArray[VDimension];
      |                                        ^~~~~~~~~~~~~~~
In member function ‘constexpr const itk::Size<VDimension>::value_type& itk::Size<VDimension>::operator[](size_type) const [with unsigned int VDimension = 2]’,
    inlined from ‘itk::Neighborhood<TPixel, VDimension, TAllocator>::SizeValueType itk::Neighborhood<TPixel, VDimension, TAllocator>::GetSize(DimensionValueType) const [with TPixel = float; unsigned int VDimension = 2; TAllocator = itk::NeighborhoodAllocator<float>]’ at [Modules/Core/Common/include/itkNeighborhood.h:147](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkNeighborhood.h#L147):18,
    inlined from ‘void itk::NeighborhoodOperator<TPixel, VDimension, TAllocator>::FillCenteredDirectional(const CoefficientVector&) [with TPixel = float; unsigned int VDimension = 2; TAllocator = itk::NeighborhoodAllocator<float>]’ at [Modules/Core/Common/include/itkNeighborhoodOperator.hxx:107](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkNeighborhoodOperator.hxx#L107):43,
    inlined from ‘void itk::DerivativeOperator<TPixel, VDimension, TAllocator>::Fill(const typename Superclass::CoefficientVector&) [with TPixel = float; unsigned int VDimension = 2; TAllocator = itk::NeighborhoodAllocator<float>]’ at [Modules/Core/Common/include/itkDerivativeOperator.h:116](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkDerivativeOperator.h#L116):40,
    inlined from ‘void itk::NeighborhoodOperator<TPixel, VDimension, TAllocator>::CreateToRadius(const typename Superclass::SizeType&) [with TPixel = float; unsigned int VDimension = 2; TAllocator = itk::NeighborhoodAllocator<float>]’ at [Modules/Core/Common/include/itkNeighborhoodOperator.hxx:81](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkNeighborhoodOperator.hxx#L81):13:
hjmjohnson commented 2 months ago
/home/johnsonhj/Dashboard/src/ITK_master/Modules/Core/Common/include/itkIndex.h:430:73: warning: array subscript 1 is above array bounds of ‘itk::Index<1>::IndexValueType [1]’ {aka ‘long int [1]’} [-Warray-bounds=]
/home/johnsonhj/Dashboard/src/ITK_master/Modules/Core/Common/include/itkSize.h:354:73: warning: array subscript 1 is above array bounds of ‘itk::Size<1>::SizeValueType [1]’ {aka ‘long unsigned int [1]’} [-Warray-bounds=]
/home/johnsonhj/Dashboard/src/ITK_master/Modules/Core/Common/include/itkSize.h:356:85: warning: array subscript 2 is above array bounds of ‘const itk::Size<2>::SizeValueType [2]’ {aka ‘const long unsigned int [2]’} [-Warray-bounds=]
/home/johnsonhj/Dashboard/src/ITK_master/Modules/Core/QuadEdgeMesh/include/itkQuadEdge.h:245:15: warning: array subscript 0 is outside array bounds of ‘QEType [0]’ [-Warray-bounds=]
/home/johnsonhj/Dashboard/src/ITK_master-simple/KWStyle/kwsCheckIndent.cxx:615:39: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
hjmjohnson commented 2 months ago

FYI: These two tests fail for ITK v5.2.1 on gcc 13.2

The following tests FAILED:
    853 - itkGDCMLegacyMultiFrameTest (Failed)
    860 - itkGDCM_ComplianceTest_singlebit (Failed)
Errors while running CTest
➜  cmake-build-release git:(gcc132-v5.2.2) ✗ ctest --rerun-failed --output-on-failure
Test project /home/johnsonhj/Dashboard/src/ITK/cmake-build-release
    Start 853: itkGDCMLegacyMultiFrameTest
1/1 Test #853: itkGDCMLegacyMultiFrameTest ......***Failed    0.36 sec
WARNING: In /home/johnsonhj/Dashboard/src/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx, line 667
MetaImageIO (0x5971e7d51690): Unsupported or empty metaData item 0008|0050 of type NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEfound, won't be written to image file

WARNING: In /home/johnsonhj/Dashboard/src/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx, line 667
MetaImageIO (0x5971e7d51690): Unsupported or empty metaData item 0008|0090 of type NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEfound, won't be written to image file

WARNING: In /home/johnsonhj/Dashboard/src/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx, line 667
MetaImageIO (0x5971e7d51690): Unsupported or empty metaData item 0008|1050 of type NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEfound, won't be written to image file

WARNING: In /home/johnsonhj/Dashboard/src/ITK/Modules/IO/Meta/src/itkMetaImageIO.cxx, line 667
MetaImageIO (0x5971e7d51690): Unsupported or empty metaData item 0020|1040 of type NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEfound, won't be written to image file

Exception detected while reading /home/johnsonhj/Dashboard/src/ITK/cmake-build-release/ExternalData/Modules/IO/GDCM/test/Baseline/itkGDCMLegacyMultiFrameTest.mha : ITK ERROR: ComparisonImageFilter(0x5971e7dc90c0): Inputs do not occupy the same physical space! 
InputImage Origin: [0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00], InputImageValidInput Origin: [-8.3217715e+01, -1.2386938e+02, 1.5993408e+02, 0.0000000e+00, 0.0000000e+00, 0.0000000e+00]
    Tolerance: 1.0000000e-06
InputImage Spacing: [1.0000000e+00, 1.0000000e+00, 1.0000000e+00, 1.0000000e+00, 1.0000000e+00, 1.0000000e+00], InputImageValidInput Spacing: [1.0000000e+00, 1.0000000e+00, 1.3300000e+00, 1.0000000e+00, 1.0000000e+00, 1.0000000e+00]
    Tolerance: 1.0000000e-06
InputImage Direction: 1.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00
0.0000000e+00 1.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 1.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 0.0000000e+00 1.0000000e+00 0.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 1.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 1.0000000e+00
, InputImageValidInput Direction: 4.3757128e-31 -1.0000000e-16 1.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00
9.7629602e-01 -2.1643955e-01 -2.1643955e-17 0.0000000e+00 0.0000000e+00 0.0000000e+00
-2.1643955e-01 -9.7629602e-01 -9.7629602e-17 0.0000000e+00 0.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 0.0000000e+00 1.0000000e+00 0.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 1.0000000e+00 0.0000000e+00
0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 1.0000000e+00

    Tolerance: 1.0000000e-06
<DartMeasurement name="BaselineImageName" type="text/string">INVALID_BASELINE_GIVEN</DartMeasurement>
thewtex commented 2 months ago

Warnings are gone with #4608 , thank you @hjmjohnson !

I get the following test failures:

        1012 - itkGDCMLegacyMultiFrameTest (Failed)
        1021 - itkGDCMImageReadWriteTest_MultiFrameMRIZSpacing (Failed)
        1023 - itkGDCM_ComplianceTest_singlebit (Failed)

CC @malaterre

thewtex commented 2 months ago

Python wrapping addressed in #4632

hjmjohnson commented 2 months ago

@thewtex FYI. I have those same 3 failing cases. I was waiting for #4608 inclusion before addressing.

Those test fail before and after #4608 so is unrelated.