Running the circuit tests crashes. Here is a full backtrace:
Thread 1 (Thread 0x7ffff7c99940 (LWP 1593666) "circuit_test"):
#0 0x00007ffff7e11907 in qk_classical_register_free () from /usr/lib/libqiskit.so
No symbol table info available.
#1 0x000055555555bd42 in Qiskit::circuit::ClassicalRegister::~ClassicalRegister (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qiskit-cpp/qiskit-cpp/src/circuit/classicalregister.hpp:80
No locals.
#2 std::_Destroy<Qiskit::circuit::ClassicalRegister> (__pointer=0x5555555770a0) at /usr/include/c++/15.2.1/bits/stl_construct.h:166
No locals.
#3 std::_Destroy<Qiskit::circuit::ClassicalRegister*> (__first=0x5555555770a0, __last=0x5555555770f8) at /usr/include/c++/15.2.1/bits/stl_construct.h:212
No locals.
#4 std::_Destroy<Qiskit::circuit::ClassicalRegister*, Qiskit::circuit::ClassicalRegister> (__first=<optimized out>, __last=0x5555555770f8) at /usr/include/c++/15.2.1/bits/alloc_traits.h:1045
No locals.
#5 std::vector<Qiskit::circuit::ClassicalRegister, std::allocator<Qiskit::circuit::ClassicalRegister> >::~vector (this=<optimized out>, this=<optimized out>) at /usr/include/c++/15.2.1/bits/stl_vector.h:802
No locals.
#6 Qiskit::circuit::QuantumCircuit::~QuantumCircuit (this=<optimized out>, this=<optimized out>) at /usr/src/debug/qiskit-cpp/qiskit-cpp/src/circuit/quantumcircuit_impl.hpp:158
No locals.
#7 0x0000555555558b0c in main () at /usr/src/debug/qiskit-cpp/qiskit-cpp/tests/circuit_test.cpp:75
qr = {<Qiskit::circuit::Register> = {_vptr.Register = 0x555555560ba0 <vtable for Qiskit::circuit::QuantumRegister+16>, size_ = 4, name_ = "q0", bits_ = std::vector of length 4, capacity 4 = {{index_ = 0, register_ = 0x7fffffffd650}, {index_ = 1, register_ = 0x7fffffffd650}, {index_ = 2, register_ = 0x7fffffffd650}, {index_ = 3, register_ = 0x7fffffffd650}}, base_index_ = 0}, rust_register_ = 0x555555575460, static instances_counter_ = 4}
cr = {<Qiskit::circuit::Register> = {_vptr.Register = 0x555555560bb8 <vtable for Qiskit::circuit::ClassicalRegister+16>, size_ = 4, name_ = "c0", bits_ = std::vector of length 4, capacity 4 = {{index_ = 0, register_ = 0x7fffffffd5f0}, {index_ = 1, register_ = 0x7fffffffd5f0}, {index_ = 2, register_ = 0x7fffffffd5f0}, {index_ = 3, register_ = 0x7fffffffd5f0}}, base_index_ = 0}, rust_register_ = 0x555555575580, static instances_counter_ = 4}
circ = {num_qubits_ = 4, num_clbits_ = 4, global_phase_ = 0, qregs_ = std::vector of length 1, capacity 1 = {{<Qiskit::circuit::Register> = {_vptr.Register = 0x555555560ba0 <vtable for Qiskit::circuit::QuantumRegister+16>, size_ = 4, name_ = "q0", bits_ = std::vector of length 4, capacity 4 = {{index_ = 0, register_ = 0x7fffffffd650}, {index_ = 1, register_ = 0x7fffffffd650}, {index_ = 2, register_ = 0x7fffffffd650}, {index_ = 3, register_ = 0x7fffffffd650}}, base_index_ = 0}, rust_register_ = 0x555555575460, static instances_counter_ = 4}}, cregs_ = std::vector of length 1, capacity 1 = {{<Qiskit::circuit::Register> = {_vptr.Register = 0x555555560bb8 <vtable for Qiskit::circuit::ClassicalRegister+16>, size_ = 4, name_ = "c0", bits_ = std::vector of length 4, capacity 4 = {{index_ = 0, register_ = 0x7fffffffd5f0}, {index_ = 1, register_ = 0x7fffffffd5f0}, {index_ = 2, register_ = 0x7fffffffd5f0}, {index_ = 3, register_ = 0x7fffffffd5f0}}, base_index_ = 0}, rust_register_ = 0x555555575580, static instances_counter_ = 4}}, rust_circuit_ = 0x555555575d20, pending_control_flow_op_ = std::shared_ptr<Qiskit::circuit::ControlFlowOp> (empty) = {get() = 0x0}, static gate_map_ = std::unordered_map with 55 elements = {["reset"] = QkGate_GlobalPhase, ["rcccx"] = QkGate_RC3X, ["rccx"] = QkGate_RCCX, ["cswap"] = QkGate_CSwap, ["measure"] = QkGate_GlobalPhase, ["ccz"] = QkGate_CCZ, ["xx_plus_yy"] = QkGate_XXPlusYY, ["xx_minus_yy"] = QkGate_XXMinusYY, ["rzz"] = QkGate_RZZ, ["ryy"] = QkGate_RYY, ["cu3"] = QkGate_CU3, ["cu"] = QkGate_CU, ["csdg"] = QkGate_CSdg, ["cs"] = QkGate_CS, ["crx"] = QkGate_CRX, ["csx"] = QkGate_CSX, ["rx"] = QkGate_RX, ["h"] = QkGate_H, ["cry"] = QkGate_CRY, ["sdg"] = QkGate_Sdg, ["u"] = QkGate_U, ["crz"] = QkGate_CRZ, ["ry"] = QkGate_RY, ["z"] = QkGate_Z, ["s"] = QkGate_S, ["tdg"] = QkGate_Tdg, ["p"] = QkGate_Phase, ["ch"] = QkGate_CH, ["rz"] = QkGate_RZ, ["r"] = QkGate_R, ["y"] = QkGate_Y, ["dcx"] = QkGate_DCX, ["rzx"] = QkGate_RZX, ["x"] = QkGate_X, ["iswap"] = QkGate_ISwap, ["i"] = QkGate_I, ["global_phase"] = QkGate_GlobalPhase, ["sx"] = QkGate_SX, ["barrier"] = QkGate_GlobalPhase, ["ccx"] = QkGate_CCX, ["ecr"] = QkGate_ECR, ["t"] = QkGate_T, ["mcx"] = QkGate_C3X, ["rxx"] = QkGate_RXX, ["cp"] = QkGate_CPhase, ["u1"] = QkGate_U1, ["c3sx"] = QkGate_C3SX, ["u2"] = QkGate_U2, ["sxdg"] = QkGate_SXdg, ["u3"] = QkGate_U3, ["cz"] = QkGate_CZ, ["cx"] = QkGate_CX, ["cu1"] = QkGate_CU1, ["cy"] = QkGate_CY, ["swap"] = QkGate_Swap}}
theta_A = 3.1000000000000001
theta_B = 2.5
phi = -0.050000000000000003
lambda = 1.3
sub_circ = {num_qubits_ = 2, num_clbits_ = 2, global_phase_ = 0, qregs_ = std::vector of length 1, capacity 1 = {{<Qiskit::circuit::Register> = {_vptr.Register = 0x555555560ba0 <vtable for Qiskit::circuit::QuantumRegister+16>, size_ = 2, name_ = "q3", bits_ = std::vector of length 2, capacity 2 = {{index_ = 0, register_ = 0x7fffffffd6b0}, {index_ = 1, register_ = 0x7fffffffd6b0}}, base_index_ = 0}, rust_register_ = 0x555555577160, static instances_counter_ = 4}}, cregs_ = std::vector of length 1, capacity 1 = {{<Qiskit::circuit::Register> = {_vptr.Register = 0x555555560bb8 <vtable for Qiskit::circuit::ClassicalRegister+16>, size_ = 2, name_ = "c3", bits_ = std::vector of length 2, capacity 2 = {{index_ = 0, register_ = 0x7fffffffd710}, {index_ = 1, register_ = 0x7fffffffd710}}, base_index_ = 0}, rust_register_ = 0x5555555771e0, static instances_counter_ = 4}}, rust_circuit_ = 0x555555577b30, pending_control_flow_op_ = std::shared_ptr<Qiskit::circuit::ControlFlowOp> (empty) = {get() = 0x0}, static gate_map_ = std::unordered_map with 55 elements = {["reset"] = QkGate_GlobalPhase, ["rcccx"] = QkGate_RC3X, ["rccx"] = QkGate_RCCX, ["cswap"] = QkGate_CSwap, ["measure"] = QkGate_GlobalPhase, ["ccz"] = QkGate_CCZ, ["xx_plus_yy"] = QkGate_XXPlusYY, ["xx_minus_yy"] = QkGate_XXMinusYY, ["rzz"] = QkGate_RZZ, ["ryy"] = QkGate_RYY, ["cu3"] = QkGate_CU3, ["cu"] = QkGate_CU, ["csdg"] = QkGate_CSdg, ["cs"] = QkGate_CS, ["crx"] = QkGate_CRX, ["csx"] = QkGate_CSX, ["rx"] = QkGate_RX, ["h"] = QkGate_H, ["cry"] = QkGate_CRY, ["sdg"] = QkGate_Sdg, ["u"] = QkGate_U, ["crz"] = QkGate_CRZ, ["ry"] = QkGate_RY, ["z"] = QkGate_Z, ["s"] = QkGate_S, ["tdg"] = QkGate_Tdg, ["p"] = QkGate_Phase, ["ch"] = QkGate_CH, ["rz"] = QkGate_RZ, ["r"] = QkGate_R, ["y"] = QkGate_Y, ["dcx"] = QkGate_DCX, ["rzx"] = QkGate_RZX, ["x"] = QkGate_X, ["iswap"] = QkGate_ISwap, ["i"] = QkGate_I, ["global_phase"] = QkGate_GlobalPhase, ["sx"] = QkGate_SX, ["barrier"] = QkGate_GlobalPhase, ["ccx"] = QkGate_CCX, ["ecr"] = QkGate_ECR, ["t"] = QkGate_T, ["mcx"] = QkGate_C3X, ["rxx"] = QkGate_RXX, ["cp"] = QkGate_CPhase, ["u1"] = QkGate_U1, ["c3sx"] = QkGate_C3SX, ["u2"] = QkGate_U2, ["sxdg"] = QkGate_SXdg, ["u3"] = QkGate_U3, ["cz"] = QkGate_CZ, ["cx"] = QkGate_CX, ["cu1"] = QkGate_CU1, ["cy"] = QkGate_CY, ["swap"] = QkGate_Swap}}
Both tests work.
Environment
What is happening?
Running the circuit tests crashes. Here is a full backtrace:
How can we reproduce the issue?
I've compiled the shared library as shown in this PKGBUILD. The library passes all the tests with ctest.
Then I've compiled the two tests from this repo using
cmake(I needed to add some missing headers and replacefrom_label(std::string& label)withfrom_label(std::string_view label), but for that I will open PRs).The other test
observable_testruns correctly, butcircuit_testcrashes.What should happen?
Both tests work.
Any suggestions?
No response