Skip to content

Commit

Permalink
handle rangeindices in array dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfhm committed Nov 23, 2023
1 parent 5231618 commit ba049e0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion transformations/transformations/pool_allocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ def _create_stack_allocation(self, stack_ptr, stack_end, ptr_var, arr, stack_siz
# Build expression for array size in bytes
dim = arr.dimensions[0]
for d in arr.dimensions[1:]:
dim = Product((dim, d))
if isinstance(d, RangeIndex):
dim = Product((dim, Sum((d.upper, Product((-1,d.lower)), IntLiteral(1)))))
else:
dim = Product((dim, d))
arr_size = Product((dim, InlineCall(Variable(name='C_SIZEOF'),
parameters=as_tuple(self._get_c_sizeof_arg(arr)))))

Expand Down

0 comments on commit ba049e0

Please sign in to comment.