Cast warning when using MKL in intel compiler
Summary
When compiling a program that has defined the macro EIGEN_USE_MKL_ALL either using the Intel compiler or the Clang compiler, a warning is thrown because of a cast of a enum const to a bool. Since I have all the warnings transformed into errors, this causes an error.
Environment
- Operating System : Linux
- Architecture : x64
- Eigen Version : 5.0.0
- Compiler Version : intel compiler 2025.1
- Compile Flags : -O3 -Wall -Werror
Minimal Example
#define EIGEN_USE_MKL_ALL
#include "Eigen/Eigen"
#include <iostream>
int main() {
Eigen::Vector3d v{1.0, -1.0, 1.0};
Eigen::Vector3d v_cos = v.array().cos();
std::cout << v_cos.transpose() * v_cos << std::endl;
}
Steps to reproduce the issue
Compile using either Intel Compiler icpx or Clang compiler with all warning activated.
What is the current bug behavior?
A warning about casting an int into a bool is thrown when compiling, because of an implicit cast.
What is the expected correct behavior?
The cast should be done explicitly so no warning is thrown.
Relevant logs
$ icpx main.cpp -o main -O3 -Wall -Werror
In file included from main.cpp:2:
In file included from ./Eigen/Eigen:1:
In file included from ./Eigen/Dense:1:
In file included from ./Eigen/Core:438:
./Eigen/src/Core/Assign_MKL.h:59:41: error: converting the enum constant to a boolean [-Werror,-Wint-in-bool-context]
59 | MightEnableVml = StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess &&
|