Open
Description
Required prerequisites
- Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
- If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
@cudaq.kernel
def bug(cond :bool) -> int:
if cond:
return 1
else:
return -1
print(cudaq.run(bug, False, shots_count = 2))
Output:
error: 'func.return' op has 0 operands, but enclosing function (@__nvqpp__mlirgen__bugMe1) returns 1
Steps to reproduce the bug
The following statement fails to compile:
if cond:
return 1
else:
return -1
The following statement works:
if cond:
return 1
return -1
Expected behavior
Output:
[ -1, -1]
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA-Q version:
- Python version:
- C++ compiler:
- Operating system:
Suggestions
No response
Metadata
Metadata
Assignees
Labels
No labels