Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

asenyaev
Copy link
Contributor

@asenyaev asenyaev commented Jul 14, 2022

This PR fixes the warning during the compilation on Linux ARM64:

[1013/2494] Building CXX object modules/features2d/CMakeFiles/opencv_features2d.dir/src/sift.dispatch.cpp.o
In file included from /opencv/modules/features2d/src/sift.dispatch.cpp:76:
/opencv/modules/features2d/src/sift.simd.hpp: In function 'void cv::cpu_baseline::calcSIFTDescriptor(const cv::Mat&, cv::Point2f, float, float, int, int, cv::Mat&, int)':
/opencv/modules/features2d/src/sift.simd.hpp:832:5: warning: iteration 7 invokes undefined behavior [-Waggressive-loop-optimizations]
  832 |     for( ; k < len; k++ )
      |     ^~~
/opencv/modules/features2d/src/sift.simd.hpp:832:14: note: within this loop
  832 |     for( ; k < len; k++ )
      |            ~~^~~~~

Link to a pipeline: https://github.com/opencv/ci-gha-workflow/runs/7237266858?check_suite_focus=true#step:16:1405

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

Copy link
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

LGTM πŸ‘

#endif
// avoid warning "iteration 7 invokes undefined behavior" on Linux ARM64
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
Copy link
Member

Choose a reason for hiding this comment

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

Large code pieces should have #if condition with GCC version check and/or affected target.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried various GCC, but currently I see only on GCC 9 series. More specifically 9.3.0 and 9.4.0

@opencv-pushbot opencv-pushbot merged commit 1377f01 into opencv:3.4 Jul 14, 2022
@asenyaev asenyaev deleted the asen/fix_warning_lnx_arm64_3.4 branch July 14, 2022 11:11
This was referenced Aug 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants