Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

kernels.hpp: getvalue(): Likely a compiler version peculiarity. #885

Open
@kuzminrobin

Description

@kuzminrobin

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)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceImprove codebase quality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions