You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running below code results in the exception copied in the "What should happen" section. I would expect the code to run without error.
How can we reproduce the issue?
import qiskit
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, transpile
from qiskit.circuit.library.standard_gates import CXGate
from qiskit.providers.basic_provider import BasicSimulator
qr = QuantumRegister(2, name='qr')
cr = ClassicalRegister(2, name='cr')
qc = QuantumCircuit(qr, cr, name='qc')
qc.append(CXGate().c_if(cr, 0).repeat(1), qargs=qr)
backend = BasicSimulator()
qc = transpile(qc, backend)
What should happen?
Traceback (most recent call last):
File "/mnt/tests/reproduction/reproduce_KeyError:Clbit(ClassicalRegister(2,'cr'),1).py", line 13, in <module>
qc = transpile(qc, backend)
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/compiler/transpiler.py", line 425, in transpile
out_circuits = pm.run(circuits, callback=callback)
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/transpiler/passmanager.py", line 397, in run
return super().run(circuits, output_name, callback, num_processes=num_processes)
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/transpiler/passmanager.py", line 420, in wrapper
return meth(*meth_args, **meth_kwargs)
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/transpiler/passmanager.py", line 182, in run
return super().run(
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/passmanager/passmanager.py", line 229, in run
out_program = _run_workflow(
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/passmanager/passmanager.py", line 292, in _run_workflow
passmanager_ir, final_state = flow_controller.execute(
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/passmanager/base_tasks.py", line 218, in execute
passmanager_ir, state = next_task.execute(
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/transpiler/basepasses.py", line 195, in execute
new_dag, state = super().execute(
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/passmanager/base_tasks.py", line 98, in execute
ret = self.run(passmanager_ir)
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/transpiler/passes/synthesis/high_level_synthesis.py", line 379, in run
decomposition, modified = self._recursively_handle_op(node.op, qubits)
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/transpiler/passes/synthesis/high_level_synthesis.py", line 467, in _recursively_handle_op
dag = circuit_to_dag(definition, copy_operations=False)
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/converters/circuit_to_dag.py", line 92, in circuit_to_dag
dagcircuit.apply_operation_back(op, instruction.qubits, instruction.clbits, check=False)
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/dagcircuit/dagcircuit.py", line 682, in apply_operation_back
[self.output_map[bit]._node_id for bits in (qargs, all_cbits) for bit in bits],
File "/root/anaconda3/envs/qiskit1.0.1/lib/python3.10/site-packages/qiskit/dagcircuit/dagcircuit.py", line 682, in <listcomp>
[self.output_map[bit]._node_id for bits in (qargs, all_cbits) for bit in bits],
KeyError: Clbit(ClassicalRegister(2, 'cr'), 0)
Any suggestions?
No response
The text was updated successfully, but these errors were encountered:
Environment
What is happening?
Running below code results in the exception copied in the "What should happen" section. I would expect the code to run without error.
How can we reproduce the issue?
What should happen?
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: