diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 2e328590c1..00449c2d63 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -437,6 +437,7 @@ RUN(NAME array_02 LABELS cpython wasm c) RUN(NAME array_03 LABELS cpython llvm c) RUN(NAME array_04 LABELS cpython llvm c) RUN(NAME array_05 LABELS cpython llvm c) +RUN(NAME array_06 LABELS cpython llvm) RUN(NAME bindc_01 LABELS cpython llvm c) RUN(NAME bindc_02 LABELS cpython llvm c) RUN(NAME bindc_04 LABELS llvm c NOFAST) diff --git a/integration_tests/array_06.py b/integration_tests/array_06.py new file mode 100644 index 0000000000..b44d4ed347 --- /dev/null +++ b/integration_tests/array_06.py @@ -0,0 +1,19 @@ +from numpy import empty, int16 +from lpython import i16, i32, Const + +def spot_print_lpython_array(a: i16[:,:]) -> None: + print(a) + +def main() -> i32: + n : Const[i32] = 15 + m : Const[i32] = 3 + Anm: i16[n, m] = empty((n,m), dtype=int16) + i: i32; j: i32 + for i in range(n): + for j in range(m): + Anm[i,j] = i16(5) + spot_print_lpython_array(Anm) + return 0 + +if __name__ == "__main__": + main() diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index a625d6f60b..d5af2946f7 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -7946,7 +7946,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor // there might be a bug below. llvm::Type *target_type = nullptr; bool character_bindc = false; - ASR::ttype_t* arg_type_ = ASRUtils::type_get_past_array(arg_type); + ASR::ttype_t* arg_type_ = ASRUtils::type_get_past_const(ASRUtils::type_get_past_array(arg_type)); switch (arg_type_->type) { case (ASR::ttypeType::Integer) : { int a_kind = down_cast(arg_type_)->m_kind;