Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions include/boost/geometry/index/detail/algorithms/content.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
#define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP

#include <boost/config.hpp>

#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
Expand All @@ -26,6 +28,18 @@

namespace boost { namespace geometry { namespace index { namespace detail {

#if defined(BOOST_GCC)
// The following pragmas set fp-contract=off for GCC, to prevent surprising and
// subtle numerical behaviour changes as a result of cross-statement/function
// FMA contractions which can result in e.g. content(b1) - content(b2) != 0
// (or < 0) for content(b1) == content(b2) (or >=), due to the fp-contract=fast
// default from at least GCC 4.4 to present GCC 15.2. This avoids Github issue
// #1452. Safe to remove after numerically robust handling of degenerate cases
// is ensured at all index::detail::content(box) call sites.
#pragma GCC push_options
#pragma GCC optimize ("fp-contract=off")
Comment thread
tinko92 marked this conversation as resolved.
#endif

template <typename Indexable>
struct default_content_result
{
Expand Down Expand Up @@ -98,6 +112,10 @@ typename default_content_result<Indexable>::type content(Indexable const& b)
>::apply(b);
}

#if defined(BOOST_GCC)
#pragma GCC pop_options
#endif

}}}} // namespace boost::geometry::index::detail

#endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_CONTENT_HPP
Loading