Checking the definition of EIGEN_ALLOCA in src/Core/util/Memory.h it appears that there is a default implementation only for Linux and Windows with MSVC. That excludes at least MacOS and Windows with MinGW/Cygwin (which all support alloca).
Indeed, for safety reason we have been very conservative regarding the use of alloca. In particular, I'm not 100% sure alloca always work with MinGW/Cygwin. I remember we had an issue with mingw, but that was with the 3.4.5 version (!) which is not supported by Eigen anymore.
Could we produce a compile-time warning (or even an error?) if EIGEN_NO_MALLOC or EIGEN_RUNTIME_NO_MALLOC is defined, but EIGEN_ALLOCA is not?
Maybe with the hint that the user should provide a definition of EIGEN_ALLOCA if he wants to avoid heap allocations.
But we also should determine minimal versions of MacOS, MinGW and Cygwin which already provide alloca.
Would it be safe enough to add an
|| (defined alloca)
to the #if condition?
Adding "|| (defined alloca)" seems to be harmless, so go for it.