boostorg / geometry

Boost.Geometry - Generic Geometry Library | Requires C++14 since Boost 1.75
http://boost.org/libs/geometry
Boost Software License 1.0
450 stars 214 forks source link

sort_by_side.hpp -Wuninitialized at line 299 #1304

Open ETatara-cadence opened 1 month ago

ETatara-cadence commented 1 month ago

This message is to report a linux compile warning/error in boost-1.81.0/geometry/algorithms/detail/overlay/sort_by_side.hpp. gcc shows -Wuninitialized at line 299, and is converted to a hard compile-error with our local usage of -Werror=uninitialized.

Investigation shows this issue may be known as "workaround for VS2015", and perhaps was not fixed for all compilers:

 /// \constructor_default_no_init
  constexpr point()

// Workaround for VS2015

if defined(_MSC_VER) && (_MSC_VER < 1910)

      : m_values() {}

else

      = default;

endif

Passing along if this could be fixed in the source. Thanks. Our compile log follows:

========================================== ENTERING: be/source/libifrbase/work ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[0]' is used uninitialized [-Werror=uninitialized] from ../../../../../include/TPtools/boost/geometry.hpp:17, from ../../../../be/source/libifrbase/include/ifrbbox.h:32, from ../../../../be/source/libifrbase/include/ifrshape.h:28, from ../../../../be/source/libifrbase/include/ifrdesign.h:26, from ../src/ifrdesign.cpp:24: ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp: In member function 'Point boost::geometry::detail::overlay::sort_by_side::side_sorter<Reverse1, Reverse2, OverlayType, Point, SideStrategy, Compare>::add(const Turn&, const Operation&, boost::geometry::signed_size_type, int, const Geometry1&, const Geometry2&, bool) [with Turn = boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy, boost::geometry::segment_ratio >; Operation = boost::geometry::detail::overlay::traversal_turn_operation<boost::geometry::model::d2::point_xy, boost::geometry::segment_ratio >; Geometry1 = boost::geometry::model::polygon<boost::geometry::model::d2::point_xy >; Geometry2 = boost::geometry::model::polygon<boost::geometry::model::d2::point_xy >; bool Reverse1 = false; bool Reverse2 = true; boost::geometry::overlay_type OverlayType = boost::geometry::overlay_difference; Point = boost::geometry::model::d2::point_xy; SideStrategy = boost::geometry::strategy::side::side_by_triangle; Compare = std::less]': ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[0]' is used uninitialized [-Werror=uninitialized] ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[1]' is used uninitialized [-Werror=uninitialized] ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[0]' is used uninitialized [-Werror=uninitialized] ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[1]' is used uninitialized [-Werror=uninitialized] make[2]: [../lni64/ifrdesign.o] Error 1 (ignored) ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[0]' is used uninitialized [-Werror=uninitialized] ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[1]' is used uninitialized [-Werror=uninitialized] ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[0]' is used uninitialized [-Werror=uninitialized] ../../../../../include/TPtools/boost/geometry/algorithms/detail/overlay/sort_by_side.hpp:299:15: error: 'point.boost::geometry::model::d2::point_xy::.boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>::m_values[1]' is used uninitialized [-Werror=uninitialized] make[2]: [../lni64/ifrshape.o] Error 1 (ignored)

vfisikop commented 2 weeks ago

Thanks for filing this issue. Could you please provide a minimal example of reproducing it? Also, have you tested if the issue persist in 1.86?

barendgehrels commented 1 week ago

The Boost.Geometry point type is not initialized indeed, it was a design decision on purpose. However, you can use your own point type and initialize it.

If you then hit an issue like this, please provide indeed a minimal example as asked by @vissarion

ETatara-cadence commented 1 week ago

We are aware of the option of using our own point type. We posted this issue after we found that the -Wuninitialized compile warning at line 299 in sort_by_side.hpp interferes with our ability to use -Werror=uninitialized.

From: Barend Gehrels @.> Sent: Wednesday, September 11, 2024 2:48 AM To: boostorg/geometry @.> Cc: Eric Tatara @.>; Author @.> Subject: Re: [boostorg/geometry] sort_by_side.hpp -Wuninitialized at line 299 (Issue #1304)

EXTERNAL MAIL

The Boost.Geometry point type is not initialized indeed, it was a design decision on purpose. However, you can use your own point type and initialize it.

If you then hit an issue like this, please provide indeed a minimal example as asked by @vissarionhttps://urldefense.com/v3/__https:/github.com/vissarion__;!!EHscmS1ygiU1lA!EnR10wJ7UOZHQW5FxyQ2XYHKHR_jYfjjhU50-nrgmmwgCc7hKpxccAzjOx4xEribuB5fer_Wj4mwGrRytw3HQzE$

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/boostorg/geometry/issues/1304*issuecomment-2342798203__;Iw!!EHscmS1ygiU1lA!EnR10wJ7UOZHQW5FxyQ2XYHKHR_jYfjjhU50-nrgmmwgCc7hKpxccAzjOx4xEribuB5fer_Wj4mwGrRy3d0X4k4$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/BKVGIZSZIKM4NGYOYWIKRTLZV7RSVAVCNFSM6AAAAABM2PYSXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNBSG44TQMRQGM__;!!EHscmS1ygiU1lA!EnR10wJ7UOZHQW5FxyQ2XYHKHR_jYfjjhU50-nrgmmwgCc7hKpxccAzjOx4xEribuB5fer_Wj4mwGrRyxDLampQ$. You are receiving this because you authored the thread.Message ID: @.***>