fix errors in windows builds and tests

Reference issue

What does this implement/fix?

Windows 32 bit builds fail when comparing pointers for equality due to this macro:

// Deal with i387 extended precision
#if EIGEN_ARCH_i386 && !(EIGEN_ARCH_x86_64)

#if EIGEN_COMP_GNUC_STRICT
#pragma GCC optimize("-ffloat-store")
#else
#undef VERIFY_IS_EQUAL
#define VERIFY_IS_EQUAL(X, Y) VERIFY_IS_APPROX(X, Y)
#endif

#endif

Rather than fix the macro (which is only used for a test), we can explicitly cast the pointer to the supported integer type for direct comparison.

Secondly, stack-allocated arrays on 32 bit platforms are typically aligned to 4 bytes, rather than the required/preferred alignment of the scalar. This causes an assertion failure in Mapbase, which reasonably assumes that std::uintptr_t(m_data) % alignof(Scalar) == 0. Rather than jury-rig the assertion, I vote to impose alignment requirements on stack-allocated arrays such that alignof(T[N]) >= alignof(T).

Finally, the failed tests in geo_homogeneous were most likely UB, and worked by coincidence on linux platforms.

Additional information

Edited by Charles Schlosser

Merge request reports

Loading