Don't use __builtin_alloca_with_align with icpc

Description

This patch fixes a linking error with Classic Intel compiler icpc. icpc does not support __builtin_alloca_with_align so this compiler needs to use the fallback eigen_aligned_alloca_helper.

Reference issue

This is a similar issue as !1721 (merged) which added support for nvc++.

Additional information

The issue without this patch can be reproduced with:

// file main.cpp
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Dense>

int main() {
    // 1. Define dynamic sizes that Eigen cannot predict at compile-time
    int rows = 4;
    int cols = 4;

    // 2. Create dynamically sized matrices (MatrixXf)
    Eigen::MatrixXf A = Eigen::MatrixXf::Random(rows, cols);
    Eigen::MatrixXf B = Eigen::MatrixXf::Random(rows, cols);
    Eigen::MatrixXf C(rows, cols);

    // 3. Perform a matrix multiplication expression evaluation.
    // Eigen evaluates A * B by instantiating an internal temporary structure.
    // Because the dimensions are dynamic but small, Eigen calls EIGEN_ALLOCA,
    // which maps directly to '__builtin_alloca_with_align' under GCC flags.
    C.noalias() = A * B;

    std::cout << "Successfully evaluated: " << C(0,0) << std::endl;
    return 0;
}
>>> icpc -O2 main.cpp $EIGEN_INCLUDE -o main

$TMPDIR/icpcjgPHOA.o: In function `void Eigen::internal::generic_product_impl<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::DenseShape, Eigen::DenseShape, 8>::evalTo<Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::Matrix<float, -1, -1, 0, -1, -1>&, Eigen::Matrix<float, -1, -1, 0, -1, -1> const&, Eigen::Matrix<float, -1, -1, 0, -1, -1> const&)':
main.cpp:(.text._ZN5Eigen8internal20generic_product_implINS_6MatrixIfLin1ELin1ELi0ELin1ELin1EEES3_NS_10DenseShapeES4_Li8EE6evalToIS3_EEvRT_RKS3_SA_[_ZN5Eigen8internal20generic_product_implINS_6MatrixIfLin1ELin1ELi0ELin1ELin1EEES3_NS_10DenseShapeES4_Li8EE6evalToIS3_EEvRT_RKS3_SA_]+0xed0): undefined reference to `__builtin_alloca_with_align'
Edited by Willem Deconinck

Merge request reports

Loading