geometry icon indicating copy to clipboard operation
geometry copied to clipboard

sort_by_side.hpp -Wuninitialized at line 299

Open ETatara-cadence opened this issue 1 year ago • 3 comments

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)

ETatara-cadence avatar Aug 20 '24 18:08 ETatara-cadence

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?

vfisikop avatar Sep 09 '24 12:09 vfisikop

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

barendgehrels avatar Sep 11 '24 06:09 barendgehrels

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.

ETatara-cadence avatar Sep 11 '24 10:09 ETatara-cadence

Closing as "by design"

barendgehrels avatar Nov 15 '24 21:11 barendgehrels