Skip to content

[BUG] required_num_results wrong when using record_output=True #235

Description

@Sola85

Environment

  • qBraid-QIR version: 0.4.0
  • Python version: 3.11.5
  • Operating system: Linux c5ce507e9ef3 6.6.87.2-microsoft-standard-WSL2

What happened?

Another minor bug:

from qbraid_qir.qasm3 import qasm3_to_qir

s = """OPENQASM 3.0;
include "stdgates.inc";
bit[1] c;
qubit[2] q;

if (c[0]) {
    z q[0];
} 
"""

qir = qasm3_to_qir(s)
print(str(qir))

generates

  ...
  br label %continue

continue:                                         ; preds = %else, %then
  call void @__quantum__rt__result_record_output(%Result* null, i8* null)
  call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null)
  ret void
}
...

attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="base" "required_num_qubits"="2" "required_num_results"="1" }

here required_num_qubits == 1 but %Result* null and %Result* inttoptr (i64 1 to %Result*) are used.

Suggestions (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions