Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: Ubuntu2404 fixes issue 4607 #4608

Conversation

hjmjohnson
Copy link
Member

@hjmjohnson hjmjohnson commented Apr 23, 2024

Fixes for 100's of warnings presented by the gcc 13.2 compiler under the upcoming Ubuntu 24.04 LTS release.

This does not fix all of the issues, but is for comparison against the master branch build

https://open.cdash.org/builds/9565813

Additional information

Related to issue #4607

These new compiler warnings are due to increased default security settings in Ubuntu 24.04.

https://ubuntu.com/blog/whats-new-in-security-for-ubuntu-24-04-lts#:~:text=Overall%2C%20the%20vast%20range%20of,most%20secure%20release%20to%20date.

PR Checklist

Refer to the ITK Software Guide for
further development details if necessary.

@hjmjohnson hjmjohnson added the type:Compiler Compiler support or related warnings label Apr 23, 2024
@hjmjohnson hjmjohnson added this to the ITK 6.0 Beta 1 milestone Apr 23, 2024
@hjmjohnson hjmjohnson self-assigned this Apr 23, 2024
@github-actions github-actions bot added type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module and removed type:Compiler Compiler support or related warnings labels Apr 23, 2024
@hjmjohnson hjmjohnson force-pushed the ubuntu2404-fixes-issue-4607 branch from b5135cc to 75a6ebd Compare April 23, 2024 17:31
@hjmjohnson hjmjohnson requested a review from N-Dekker April 23, 2024 17:36
@hjmjohnson hjmjohnson force-pushed the ubuntu2404-fixes-issue-4607 branch 3 times, most recently from 6130b79 to 720e089 Compare April 26, 2024 23:56
@github-actions github-actions bot added area:IO Issues affecting the IO module area:Segmentation Issues affecting the Segmentation module labels Apr 26, 2024
@hjmjohnson hjmjohnson force-pushed the ubuntu2404-fixes-issue-4607 branch from 720e089 to 931ded8 Compare April 27, 2024 13:36
@github-actions github-actions bot added the type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots label Apr 27, 2024
@hjmjohnson hjmjohnson force-pushed the ubuntu2404-fixes-issue-4607 branch 4 times, most recently from da2f03e to d027b63 Compare April 28, 2024 14:51
@hjmjohnson hjmjohnson marked this pull request as ready for review April 28, 2024 15:24
@hjmjohnson hjmjohnson changed the title WIP: Ubuntu2404 fixes issue 4607 COMP: Ubuntu2404 fixes issue 4607 Apr 28, 2024
@hjmjohnson hjmjohnson force-pushed the ubuntu2404-fixes-issue-4607 branch from d027b63 to 66d71ee Compare April 28, 2024 16:33
@github-actions github-actions bot added the type:Compiler Compiler support or related warnings label Apr 28, 2024
@hjmjohnson
Copy link
Member Author

/azp run ITK.Linux

@hjmjohnson hjmjohnson requested a review from dzenanz April 28, 2024 23:29
@hjmjohnson hjmjohnson requested a review from N-Dekker April 28, 2024 23:29
@hjmjohnson hjmjohnson force-pushed the ubuntu2404-fixes-issue-4607 branch 2 times, most recently from 529d2f2 to 5e29345 Compare April 29, 2024 17:18
@github-actions github-actions bot removed type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:IO Issues affecting the IO module area:Segmentation Issues affecting the Segmentation module labels Apr 29, 2024
@hjmjohnson
Copy link
Member Author

This allows for clean building on the latest Ubuntu 24.04 release with GCC 13.2.

Copy link
Member

@blowekamp blowekamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing these warnings. A suggestion to consider, that would reduce code size.

Modules/Core/Common/include/itkNeighborhood.h Outdated Show resolved Hide resolved
Modules/Core/Common/include/itkNeighborhood.h Outdated Show resolved Hide resolved
@hjmjohnson hjmjohnson removed this from the ITK 6.0 Beta 1 milestone Apr 30, 2024
The gcc 13.2 compiler warns about potential index out
of bounds errors in cases where the index is not explicitly
requested is not explicitly tested.

Avoid using index operator when index would be
out of known compile time bounds.

In member function 'constexpr const itk::Size<VDimension>::value_type&
itk::Size<VDimension>::operator[](size_type) const [with unsigned int
VDimension = 2]',

ITK/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=] 356 |
constexpr const_reference operator[](size_type pos) const { return
m_InternalArray[pos]; }
The down-casted object is never used.  Only the existence of the
pointer is needed, and the type of the pointer is not relavant.
Providing tests for the known container size requirements
makes the test more transparent.
The number really does not matter, but make a variable
to indicate where it needs to be consistent in the test.
…essing

Change testing pixel type to unsigned short to avoid compiler string processing
security checking that issued a false positive warning.

In function '_OIter std::reverse_copy(_BIter, _BIter, _OIter)
  [with _BIter = __gnu_cxx::__normal_iterator<const unsigned char*, vector<unsigned char> >;
           _OIter = __gnu_cxx::__normal_iterator<unsigned char*, vector<unsigned char> >]',

  inlined from 'virtual void ShapedImageNeighborhoodRange_IteratorsCanBePassedToStdReverseCopy_Test::TestBody()'
        at ITK/Modules/Core/Common/test/itkShapedImageNeighborhoodRangeGTest.cxx:379:20:
  /usr/include/c++/13/bits/stl_algo.h:1172:21: warning: writing 1 byte into a region of size 0
  [-Wstringop-overflow=]
    1172 |           *__result = *__last;
         |           ~~~~~~~~~~^~~~~~~~~
Remove suppression of warnings about using c++14 features
that are not mandatory to be implemented in minimum
supported c++17.

We now require c++17, so do not warn if c++14 features
are used.
In member function 'unsigned int itk::SymmetricEigenAnalysis<TMatrix, TVector, TEigenMatrix>::ComputeEigenValuesLegacy(const TMatrix&, TVector&) const [with TMatrix = itk::SymmetricSecondRankTensor<float, 3>; TVector = itk::FixedArray<double, 3>; TEigenMatrix = itk::SymmetricSecondRankTensor<float, 3>]',
    inlined from 'unsigned int itk::SymmetricEigenAnalysis<TMatrix, TVector, TEigenMatrix>::ComputeEigenValues(const TMatrix&, TVector&) const [with TMatrix = itk::SymmetricSecondRankTensor<float, 3>; TVector = itk::FixedArray<double, 3>; TEigenMatrix = itk::SymmetricSecondRankTensor<float, 3>]' at ITK/Modules/Core/Common/include/itkSymmetricEigenAnalysis.hxx:36:36,
    inlined from 'TOutput itk::Functor::SymmetricEigenAnalysisFunction<TInput, TOutput>::operator()(const TInput&) const [with TInput = itk::SymmetricSecondRankTensor<float, 3>; TOutput = itk::FixedArray<double, 3>]' at ITK/Modules/Filtering/ImageIntensity/include/itkSymmetricEigenAnalysisImageFilter.h:61:36,
    inlined from 'void itk::UnaryFunctorImageFilter<TInputImage, TOutputImage, TFunction>::DynamicThreadedGenerateData(const OutputImageRegionType&) [with TInputImage = itk::Image<itk::SymmetricSecondRankTensor<float, 3>, 3>; TOutputImage = itk::Image<itk::FixedArray<double, 3>, 3>; TFunction = itk::Functor::SymmetricEigenAnalysisFunction<itk::SymmetricSecondRankTensor<float, 3>, itk::FixedArray<double, 3> >]' at ITK/Modules/Core/Common/include/itkUnaryFunctorImageFilter.hxx:97:29:
ITK/Modules/Core/Common/include/itkSymmetricEigenAnalysis.hxx:70:18: warning: 'eigenValues' may be used uninitialized [-Wmaybe-uninitialized]
   70 |     dVector[row] = D[row];
In file included from ITK/Modules/Filtering/ImageIntensity/test/itkSymmetricEigenAnalysisImageFilterTest.cxx:22:
ITK/Modules/Filtering/ImageIntensity/include/itkSymmetricEigenAnalysisImageFilter.h: In member function 'void itk::UnaryFunctorImageFilter<TInputImage, TOutputImage, TFunction>::DynamicThreadedGenerateData(const OutputImageRegionType&) [with TInputImage = itk::Image<itk::SymmetricSecondRankTensor<float, 3>, 3>; TOutputImage = itk::Image<itk::FixedArray<double, 3>, 3>; TFunction = itk::Functor::SymmetricEigenAnalysisFunction<itk::SymmetricSecondRankTensor<float, 3>, itk::FixedArray<double, 3> >]':
ITK/Modules/Filtering/ImageIntensity/include/itkSymmetricEigenAnalysisImageFilter.h:59:13: note: 'eigenValues' declared here
   59 |     TOutput eigenValues;
      |             ^~~~~~~~~~~
In member function 'itk::QuadEdge::Self* itk::QuadEdge::GetSym()',
    inlined from 'itk::GeometricalQuadEdge<TVRef, TFRef, TPrimalData, TDualData, PrimalDual>::Self* itk::GeometricalQuadEdge<TVRef, TFRef, TPrimalData, TDualData, PrimalDual>::GetSym() [with TVRef = long unsigned int; TFRef = long unsigned int; TPrimalData = bool; TDualData = bool; bool PrimalDual = true]' at ITK/Modules/Core/QuadEdgeMesh/include/itkGeometricalQuadEdge.h:106:3,
    inlined from 'typename itk::QuadEdgeMeshEulerOperatorSplitEdgeFunction<TMesh, TQEType>::Superclass::OutputType itk::QuadEdgeMeshEulerOperatorSplitEdgeFunction<TMesh, TQEType>::Evaluate(QEType*) [with TMesh = itk::QuadEdgeMesh<double, 3>; TQEType = itk::GeometricalQuadEdge<long unsigned int, long unsigned int, bool, bool, true>]' at ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitEdgeFunction.h:76:36,
    inlined from 'int itkQuadEdgeMeshEulerOperatorSplitEdgeTest(int, char**)' at ITK/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshEulerOperatorSplitEdgeTest.cxx:45:26:
ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdge.h:245:15: warning: array subscript 0 is outside array bounds of 'QEType [0]' [-Warray-bounds=]
  245 |     if (this->m_Rot)
      |         ~~~~~~^~~~~
@hjmjohnson hjmjohnson force-pushed the ubuntu2404-fixes-issue-4607 branch from 5e29345 to 462a874 Compare April 30, 2024 13:44
Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing these @hjmjohnson !

@hjmjohnson hjmjohnson added this to the ITK 5.4.0 milestone Apr 30, 2024
@hjmjohnson
Copy link
Member Author

@thewtex I assume we want 5.4.0 to build cleanly on Ubuntu 24.04. This is a lot of small changes, but I think they are appropriate for 5.4.0.

I'll let you merge, or change the milestone. If you change the milestone, please convert to a draft.

@thewtex thewtex merged commit b5b105d into InsightSoftwareConsortium:master May 1, 2024
14 checks passed
@hjmjohnson hjmjohnson deleted the ubuntu2404-fixes-issue-4607 branch January 26, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module type:Compiler Compiler support or related warnings type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants