diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 9e742a7702..e7c0c9b634 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -312,6 +312,9 @@ RUN(NAME structs_07 LABELS llvm c RUN(NAME structs_08 LABELS cpython llvm c) RUN(NAME structs_09 LABELS cpython llvm c) RUN(NAME structs_10 LABELS cpython llvm c) +RUN(NAME structs_12 LABELS cpython llvm c) +RUN(NAME structs_13 LABELS llvm c + EXTRAFILES structs_13b.c) RUN(NAME sizeof_01 LABELS llvm c EXTRAFILES sizeof_01b.c) RUN(NAME enum_01 LABELS cpython llvm c) diff --git a/integration_tests/structs_12.py b/integration_tests/structs_12.py new file mode 100644 index 0000000000..cb48e11125 --- /dev/null +++ b/integration_tests/structs_12.py @@ -0,0 +1,17 @@ +from ltypes import i32, i16, dataclass + +@dataclass +class A: + x: i32 + y: i16 + +def add_A_members(Ax: i32, Ay: i16) -> i32: + return Ax + i32(Ay) + +def test_A_member_passing(): + a: A = A(0, i16(1)) + sum_A_members: i32 = add_A_members(a.x, a.y) + print(sum_A_members) + assert sum_A_members == 1 + +test_A_member_passing() diff --git a/integration_tests/structs_13.py b/integration_tests/structs_13.py new file mode 100644 index 0000000000..03b402b4b8 --- /dev/null +++ b/integration_tests/structs_13.py @@ -0,0 +1,43 @@ +from ltypes import i32, i16, i64, CPtr, dataclass, ccall, Pointer, c_p_pointer + +@dataclass +class A: + x: i32 + y: i16 + +@ccall +def cmalloc(size: i64) -> CPtr: + pass + +@ccall +def is_null(ptr: CPtr) -> i32: + pass + +def add_A_members(Ax: i32, Ay: i16) -> i32: + return Ax + i32(Ay) + +def test_A_member_passing(): + array_cptr: CPtr = cmalloc(sizeof(A) * i64(10)) + assert not bool(is_null(array_cptr)), "Failed to allocate array on memory" + array_ptr: Pointer[A[:]] + c_p_pointer(array_cptr, array_ptr) + i: i32; sum_A_members: i32 + for i in range(10): + array_ptr[i] = A(i, i16(i + 1)) + + for i in range(5): + a: A = array_ptr[i] + sum_A_members = add_A_members(a.x, a.y) + assert a.x == i + assert a.y == i16(i + 1) + print(sum_A_members) + assert sum_A_members == 2*i + 1 + + for i in range(6, 10): + sum_A_members = add_A_members(array_ptr[i].x, array_ptr[i].y) + assert array_ptr[i].x == i + assert array_ptr[i].y == i16(i + 1) + print(sum_A_members) + assert sum_A_members == 2*i + 1 + +test_A_member_passing() diff --git a/integration_tests/structs_13b.c b/integration_tests/structs_13b.c new file mode 100644 index 0000000000..1abbc17ee6 --- /dev/null +++ b/integration_tests/structs_13b.c @@ -0,0 +1,9 @@ +#include + +void* cmalloc(int64_t size) { + return malloc(size); +} + +int32_t is_null(void* ptr) { + return ptr == NULL; +} diff --git a/integration_tests/structs_13b.h b/integration_tests/structs_13b.h new file mode 100644 index 0000000000..38212a603a --- /dev/null +++ b/integration_tests/structs_13b.h @@ -0,0 +1,4 @@ +#include + +void* cmalloc(int64_t size); +int32_t is_null(void* ptr); diff --git a/src/libasr/codegen/asr_to_c.cpp b/src/libasr/codegen/asr_to_c.cpp index 4e657289c3..7f39eb197d 100644 --- a/src/libasr/codegen/asr_to_c.cpp +++ b/src/libasr/codegen/asr_to_c.cpp @@ -205,13 +205,14 @@ class ASRToCVisitor : public BaseCCPPVisitor ASR::ttype_t* element_type, bool& is_fixed_size, bool convert_to_1d=false) { - std::string dims; + std::string dims = ""; size_t size = 1; std::string array_size = ""; for (size_t i=0; i if( !is_fixed_size ) { sub += indent + format_type_c("*", type_name_copy, std::string(v_m_name) + "_data", use_ref, dummy); - sub += " = " + dims + ";\n"; + if( dims.size() > 0 ) { + sub += " = " + dims + ";\n"; + } else { + sub += ";\n"; + } } else { sub += indent + format_type_c(dims, type_name_copy, std::string(v_m_name) + "_data", use_ref, dummy) + ";\n"; @@ -360,14 +365,25 @@ class ASRToCVisitor : public BaseCCPPVisitor } else if(ASR::is_a(*t2)) { ASR::Struct_t *t = ASR::down_cast(t2); std::string der_type_name = ASRUtils::symbol_name(t->m_derived_type); - bool is_fixed_size = true; - std::string dims = convert_dims_c(t->n_dims, t->m_dims, v_m_type, is_fixed_size); - std::string ptr_char = "*"; - if( !use_ptr_for_derived_type ) { - ptr_char.clear(); + if( is_array ) { + bool is_fixed_size = true; + std::string dims = convert_dims_c(t->n_dims, t->m_dims, v_m_type, is_fixed_size, true); + std::string encoded_type_name = "x" + der_type_name; + std::string type_name = std::string("struct ") + der_type_name; + generate_array_decl(sub, std::string(v.m_name), type_name, dims, + encoded_type_name, t->m_dims, t->n_dims, + use_ref, dummy, + v.m_intent != ASRUtils::intent_in && + v.m_intent != ASRUtils::intent_inout, + is_fixed_size); + } else { + std::string ptr_char = "*"; + if( !use_ptr_for_derived_type ) { + ptr_char.clear(); + } + sub = format_type_c("", "struct " + der_type_name + ptr_char, + v.m_name, use_ref, dummy); } - sub = format_type_c(dims, "struct " + der_type_name + ptr_char, - v.m_name, use_ref, dummy); } else if(ASR::is_a(*t2)) { sub = format_type_c("", "void**", v.m_name, false, false); } else { diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index 377185f98f..0fbf46f489 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -1685,8 +1685,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor llvm::Value* array = nullptr; if( ASR::is_a(*x.m_v) ) { ASR::Variable_t *v = ASRUtils::EXPR2VAR(x.m_v); - if( ASR::is_a(*v->m_type) ) { - ASR::Struct_t* der_type = ASR::down_cast(v->m_type); + if( ASR::is_a(*ASRUtils::get_contained_type(v->m_type)) ) { + ASR::Struct_t* der_type = ASR::down_cast( + ASRUtils::get_contained_type(v->m_type)); der_type_name = ASRUtils::symbol_name(ASRUtils::symbol_get_past_external(der_type->m_derived_type)); } uint32_t v_h = get_hash((ASR::asr_t*)v); @@ -5968,7 +5969,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor builder0.SetInsertPoint(&entry_block, entry_block.getFirstInsertionPt()); llvm::AllocaInst *target = builder0.CreateAlloca( target_type, nullptr, "call_arg_value"); - if( ASR::is_a(*x.m_args[i].m_value) ) { + if( ASR::is_a(*x.m_args[i].m_value) || + ASR::is_a(*x.m_args[i].m_value) ) { value = CreateLoad(value); } if( ASR::is_a(*arg_type) || diff --git a/src/libasr/pass/pass_utils.h b/src/libasr/pass/pass_utils.h index 2f983a6040..dc1950816f 100644 --- a/src/libasr/pass/pass_utils.h +++ b/src/libasr/pass/pass_utils.h @@ -180,6 +180,12 @@ namespace LFortran { } } + void visit_DoLoop(const ASR::DoLoop_t& x) { + self().visit_do_loop_head(x.m_head); + ASR::DoLoop_t& xx = const_cast(x); + transform_stmts(xx.m_body, xx.n_body); + } + }; template diff --git a/src/lpython/semantics/python_ast_to_asr.cpp b/src/lpython/semantics/python_ast_to_asr.cpp index 0790660bf2..d1e115c9fe 100644 --- a/src/lpython/semantics/python_ast_to_asr.cpp +++ b/src/lpython/semantics/python_ast_to_asr.cpp @@ -3082,7 +3082,7 @@ class CommonVisitor : public AST::BaseVisitor { if( is_item ) { Vec empty_dims; empty_dims.reserve(al, 1); - type = ASRUtils::duplicate_type(al, type, &empty_dims); + type = ASRUtils::duplicate_type(al, ASRUtils::type_get_past_pointer(type), &empty_dims); tmp = ASR::make_ArrayItem_t(al, x.base.base.loc, v_Var, args.p, args.size(), type, ASR::arraystorageType::RowMajor, nullptr); } else { diff --git a/tests/reference/asr-bindc_02-bc1a7ea.json b/tests/reference/asr-bindc_02-bc1a7ea.json index c023c664d3..dbdd9eab72 100644 --- a/tests/reference/asr-bindc_02-bc1a7ea.json +++ b/tests/reference/asr-bindc_02-bc1a7ea.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-bindc_02-bc1a7ea.stdout", - "stdout_hash": "cb68f1c64e50e326c38c102f0dc26a26274be2f4f9d1423658fa0ad4", + "stdout_hash": "3165b2da8871ec50f1243662d58fe93d7b92c3166ef180eca07d2152", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-bindc_02-bc1a7ea.stdout b/tests/reference/asr-bindc_02-bc1a7ea.stdout index d8401222b8..af8b53bf02 100644 --- a/tests/reference/asr-bindc_02-bc1a7ea.stdout +++ b/tests/reference/asr-bindc_02-bc1a7ea.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Function (SymbolTable 4 {}) _lpython_main_program [f] [] [(CPtrToPointer (Var 1 queries) (Var 1 x) ()) (Print () [(Var 1 queries) (Var 1 x)] () ()) (SubroutineCall 1 f () [] ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), f: (Function (SymbolTable 2 {y: (Variable 2 y Local () () Default (Integer 2 [((IntegerConstant 0 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])))]) Source Public Required .false.), yptr1: (Variable 2 yptr1 Local () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.), yq: (Variable 2 yq Local () () Default (CPtr) Source Public Required .false.)}) f [] [] [(= (ArrayItem (Var 2 y) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (Cast (IntegerConstant 1 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 1 (Integer 2 []))) ()) (= (ArrayItem (Var 2 y) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 2 (Integer 2 []))) ()) (= (Var 2 yptr1) (GetPointer (Var 2 y) (Pointer (Integer 2 [((IntegerConstant 0 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])))])) ()) ()) (Print () [(GetPointer (Var 2 y) (Pointer (Integer 2 [((IntegerConstant 0 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])))])) ()) (Var 2 yptr1)] () ()) (Print () [(ArrayItem (Var 2 yptr1) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Pointer (Integer 2 [])) RowMajor ()) (ArrayItem (Var 2 yptr1) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Pointer (Integer 2 [])) RowMajor ())] () ()) (Assert (IntegerCompare (ArrayItem (Var 2 yptr1) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Pointer (Integer 2 [])) RowMajor ()) Eq (Cast (IntegerConstant 1 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 1 (Integer 2 []))) (Logical 4 []) ()) ()) (Assert (IntegerCompare (ArrayItem (Var 2 yptr1) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Pointer (Integer 2 [])) RowMajor ()) Eq (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 2 (Integer 2 []))) (Logical 4 []) ()) ()) (CPtrToPointer (Var 2 yq) (Var 2 yptr1) ()) (Print () [(Var 2 yq) (Var 2 yptr1)] () ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), main_program: (Program (SymbolTable 3 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), queries: (Variable 1 queries Local () () Default (CPtr) Source Public Required .false.), x: (Variable 1 x Local () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.)}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Function (SymbolTable 4 {}) _lpython_main_program [f] [] [(CPtrToPointer (Var 1 queries) (Var 1 x) ()) (Print () [(Var 1 queries) (Var 1 x)] () ()) (SubroutineCall 1 f () [] ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), f: (Function (SymbolTable 2 {y: (Variable 2 y Local () () Default (Integer 2 [((IntegerConstant 0 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])))]) Source Public Required .false.), yptr1: (Variable 2 yptr1 Local () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.), yq: (Variable 2 yq Local () () Default (CPtr) Source Public Required .false.)}) f [] [] [(= (ArrayItem (Var 2 y) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (Cast (IntegerConstant 1 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 1 (Integer 2 []))) ()) (= (ArrayItem (Var 2 y) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 2 (Integer 2 []))) ()) (= (Var 2 yptr1) (GetPointer (Var 2 y) (Pointer (Integer 2 [((IntegerConstant 0 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])))])) ()) ()) (Print () [(GetPointer (Var 2 y) (Pointer (Integer 2 [((IntegerConstant 0 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])))])) ()) (Var 2 yptr1)] () ()) (Print () [(ArrayItem (Var 2 yptr1) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (ArrayItem (Var 2 yptr1) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 2 []) RowMajor ())] () ()) (Assert (IntegerCompare (ArrayItem (Var 2 yptr1) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) Eq (Cast (IntegerConstant 1 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 1 (Integer 2 []))) (Logical 4 []) ()) ()) (Assert (IntegerCompare (ArrayItem (Var 2 yptr1) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) Eq (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 2 (Integer 2 []))) (Logical 4 []) ()) ()) (CPtrToPointer (Var 2 yq) (Var 2 yptr1) ()) (Print () [(Var 2 yq) (Var 2 yptr1)] () ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), main_program: (Program (SymbolTable 3 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), queries: (Variable 1 queries Local () () Default (CPtr) Source Public Required .false.), x: (Variable 1 x Local () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.)}) []) diff --git a/tests/reference/asr-expr_12-6769be0.json b/tests/reference/asr-expr_12-6769be0.json index 3779876194..f1ceccb2ef 100644 --- a/tests/reference/asr-expr_12-6769be0.json +++ b/tests/reference/asr-expr_12-6769be0.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr_12-6769be0.stdout", - "stdout_hash": "6a3e6336c777defb05cb3c6c244ed20468ea29c584a8bf5c9f311122", + "stdout_hash": "90152a321955a2c86da3e2036530feea66c16f9c4057cfcd8c92113e", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr_12-6769be0.stdout b/tests/reference/asr-expr_12-6769be0.stdout index 4790b3729e..fe76c35a86 100644 --- a/tests/reference/asr-expr_12-6769be0.stdout +++ b/tests/reference/asr-expr_12-6769be0.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Function (SymbolTable 6 {}) _lpython_main_program [f] [] [(SubroutineCall 1 f () [] ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), check: (Function (SymbolTable 3 {ptr: (Variable 3 ptr InOut () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.)}) check [] [(Var 3 ptr)] [(Assert (IntegerCompare (ArrayItem (Var 3 ptr) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Pointer (Integer 2 [])) RowMajor ()) Eq (Cast (IntegerConstant 1 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 1 (Integer 2 []))) (Logical 4 []) ()) ()) (Assert (IntegerCompare (ArrayItem (Var 3 ptr) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Pointer (Integer 2 [])) RowMajor ()) Eq (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 2 (Integer 2 []))) (Logical 4 []) ()) ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), f: (Function (SymbolTable 4 {y: (Variable 4 y Local () () Default (Integer 2 [((IntegerConstant 0 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])))]) Source Public Required .false.), yptr1: (Variable 4 yptr1 Local () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.)}) f [g check] [] [(SubroutineCall 1 g () [((Var 4 yptr1)) ((Var 4 y))] ()) (SubroutineCall 1 check () [((Var 4 yptr1))] ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), g: (Function (SymbolTable 2 {x: (Variable 2 x InOut () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.), y: (Variable 2 y InOut () () Default (Integer 2 [(() ())]) Source Public Required .false.)}) g [] [(Var 2 x) (Var 2 y)] [(= (ArrayItem (Var 2 y) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (Cast (IntegerConstant 1 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 1 (Integer 2 []))) ()) (= (ArrayItem (Var 2 y) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 2 (Integer 2 []))) ()) (= (Var 2 x) (GetPointer (Var 2 y) (Pointer (Integer 2 [(() ())])) ()) ()) (Print () [(ArrayItem (Var 2 x) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Pointer (Integer 2 [])) RowMajor ()) (ArrayItem (Var 2 x) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Pointer (Integer 2 [])) RowMajor ())] () ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), main_program: (Program (SymbolTable 5 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())])}) []) +(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Function (SymbolTable 6 {}) _lpython_main_program [f] [] [(SubroutineCall 1 f () [] ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), check: (Function (SymbolTable 3 {ptr: (Variable 3 ptr InOut () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.)}) check [] [(Var 3 ptr)] [(Assert (IntegerCompare (ArrayItem (Var 3 ptr) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) Eq (Cast (IntegerConstant 1 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 1 (Integer 2 []))) (Logical 4 []) ()) ()) (Assert (IntegerCompare (ArrayItem (Var 3 ptr) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) Eq (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 2 (Integer 2 []))) (Logical 4 []) ()) ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), f: (Function (SymbolTable 4 {y: (Variable 4 y Local () () Default (Integer 2 [((IntegerConstant 0 (Integer 4 [])) (IntegerConstant 2 (Integer 4 [])))]) Source Public Required .false.), yptr1: (Variable 4 yptr1 Local () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.)}) f [g check] [] [(SubroutineCall 1 g () [((Var 4 yptr1)) ((Var 4 y))] ()) (SubroutineCall 1 check () [((Var 4 yptr1))] ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), g: (Function (SymbolTable 2 {x: (Variable 2 x InOut () () Default (Pointer (Integer 2 [(() ())])) Source Public Required .false.), y: (Variable 2 y InOut () () Default (Integer 2 [(() ())]) Source Public Required .false.)}) g [] [(Var 2 x) (Var 2 y)] [(= (ArrayItem (Var 2 y) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (Cast (IntegerConstant 1 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 1 (Integer 2 []))) ()) (= (ArrayItem (Var 2 y) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToInteger (Integer 2 []) (IntegerConstant 2 (Integer 2 []))) ()) (= (Var 2 x) (GetPointer (Var 2 y) (Pointer (Integer 2 [(() ())])) ()) ()) (Print () [(ArrayItem (Var 2 x) [(() (IntegerConstant 0 (Integer 4 [])) ())] (Integer 2 []) RowMajor ()) (ArrayItem (Var 2 x) [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 2 []) RowMajor ())] () ())] () Source Public Implementation () .false. .false. .false. .false. .false. [] [] .false.), main_program: (Program (SymbolTable 5 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())])}) [])