kernels.hpp: getvalue()
: Likely a compiler version peculiarity. #885
Description
src\Simulation\Native\src\simulator\kernels.hpp
template <class T, class A>
unsigned getvalue(
std::vector<std::complex<T>, A> const& wfn,
unsigned q,
double eps = 100. * std::numeric_limits<T>::epsilon())
With GCC no problems.
With clang returns something unexpected in release config on Win and Mac (works fine in debug on all platforms, and release on Mac). What exactly it returns is hard to debug, the release config has no debug info, the RelWithDebInfo config inlines the calls and steps over, doesn't show the value returned.
Eventually the test fails Tests.Microsoft.Quantum.Simulators/Microsoft.Quantum.Simulation.Simulators.Tests/QuantumSimulatorTests/ZeroStateQubitReleaseTest
.
Likely something specific in clang-11 (on Win and Linux) as opposed to AppleClang-13 (on Mac).
Temporary solution - __attribute__((noinline))
(after )
and before {
).
After migrating to clang-13 on Win and Linux try to remove the __attribute__((noinline))
.