File tree Expand file tree Collapse file tree
include/boost/geometry/index/detail/algorithms Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
1717#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
1818
19+ #include < boost/config.hpp>
20+
1921#include < boost/geometry/core/access.hpp>
2022#include < boost/geometry/core/coordinate_dimension.hpp>
2123#include < boost/geometry/core/coordinate_type.hpp>
2628
2729namespace boost { namespace geometry { namespace index { namespace detail {
2830
31+ #if defined(BOOST_GCC)
32+ // The following pragmas set fp-contract=off for GCC, to prevent surprising and
33+ // subtle numerical behaviour changes as a result of cross-statement/function
34+ // FMA contractions which can result in e.g. content(b1) - content(b2) != 0
35+ // (or < 0) for content(b1) == content(b2) (or >=), due to the fp-contract=fast
36+ // default from at least GCC 4.4 to present GCC 15.2. This avoids Github issue
37+ // #1452. Safe to remove after numerically robust handling of degenerate cases
38+ // is ensured at all index::detail::content(box) call sites.
39+ #pragma GCC push_options
40+ #pragma GCC optimize ("fp-contract=off")
41+ #endif
42+
2943template <typename Indexable>
3044struct default_content_result
3145{
@@ -98,6 +112,10 @@ typename default_content_result<Indexable>::type content(Indexable const& b)
98112 >::apply (b);
99113}
100114
115+ #if defined(BOOST_GCC)
116+ #pragma GCC pop_options
117+ #endif
118+
101119}}}} // namespace boost::geometry::index::detail
102120
103121#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
You can’t perform that action at this time.
0 commit comments