Skip to content

typedef std::uintptr_t UIntPtr

My team are working on porting some third party libraries to a new architecture with a new experimental instruction set based on capabilities ("fat pointers"). Eigen works perfectly except for one instance. The architecture is called ARM Morello and the instruction set is called CHERI.

In Meta.h, line 98, there is the following section:

#if EIGEN_ICC_NEEDS_CSTDINT
typedef std::intptr_t  IntPtr;
typedef std::uintptr_t UIntPtr;
#else
typedef std::ptrdiff_t IntPtr;
typedef std::size_t UIntPtr;
#endif

The typedef of UIntPtr to size_t presents a problem on this architecture, where plain int types cannot necessarily be used as pointers, or in pointer arithmetic. We'd like to push a fix, but before doing so we'd like to fully understand the choice made here. Can anyone point me in the direction of some reading to better understand these ICC constraints that force this choice?

(In addition, I haven't yet identified the point in the code where EIGEN_ICC_NEEDS_CSTDINT is injected, so if you could point me in the right direction that would be very helpful).

We have found that simply changing size_t to uintptr_t creates no issues, and leads to a successful build and passing tests on the Morello platform running CheriBSD, but haven't tested on other platforms yet.

Thanks