Skip to content

Commit 2c53548

Browse files
committed
Handle 0 sized arrays
1 parent 888e457 commit 2c53548

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

hugr-llvm/src/extension/collections/borrow_array.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,9 @@ pub fn build_none_borrowed_check<'c, H: HugrView<Node = Node>>(
719719
offset: IntValue<'c>,
720720
size: u64,
721721
) -> Result<()> {
722+
if size == 0 {
723+
return Ok(())
724+
}
722725
// Wrap the check into a function instead of inlining
723726
const FUNC_NAME: &str = "__barray_check_none_borrowed";
724727
let usize_t = usize_ty(&ctx.typing_session());
@@ -764,6 +767,9 @@ pub fn build_all_borrowed_check<'c, H: HugrView<Node = Node>>(
764767
offset: IntValue<'c>,
765768
size: u64,
766769
) -> Result<()> {
770+
if size == 0 {
771+
return Ok(())
772+
}
767773
// Wrap the check into a function instead of inlining
768774
const FUNC_NAME: &str = "__barray_check_all_borrowed";
769775
let usize_t = usize_ty(&ctx.typing_session());

0 commit comments

Comments
 (0)