Skip to content

Fixes for Struct and StructInstanceMember use cases #1292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions integration_tests/structs_12.py
Original file line number Diff line number Diff line change
@@ -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()
43 changes: 43 additions & 0 deletions integration_tests/structs_13.py
Original file line number Diff line number Diff line change
@@ -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()
9 changes: 9 additions & 0 deletions integration_tests/structs_13b.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <stdlib.h>

void* cmalloc(int64_t size) {
return malloc(size);
}

int32_t is_null(void* ptr) {
return ptr == NULL;
}
4 changes: 4 additions & 0 deletions integration_tests/structs_13b.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <inttypes.h>

void* cmalloc(int64_t size);
int32_t is_null(void* ptr);
36 changes: 26 additions & 10 deletions src/libasr/codegen/asr_to_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,14 @@ class ASRToCVisitor : public BaseCCPPVisitor<ASRToCVisitor>
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<n_dims; i++) {
ASR::expr_t *length = m_dims[i].m_length;
if (!length) {
dims += "*";
is_fixed_size = false;
return dims;
} else {
visit_expr(*length);
array_size += "*" + src;
Expand Down Expand Up @@ -285,7 +286,11 @@ class ASRToCVisitor : public BaseCCPPVisitor<ASRToCVisitor>
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";
Expand Down Expand Up @@ -360,14 +365,25 @@ class ASRToCVisitor : public BaseCCPPVisitor<ASRToCVisitor>
} else if(ASR::is_a<ASR::Struct_t>(*t2)) {
ASR::Struct_t *t = ASR::down_cast<ASR::Struct_t>(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<ASR::CPtr_t>(*t2)) {
sub = format_type_c("", "void**", v.m_name, false, false);
} else {
Expand Down
8 changes: 5 additions & 3 deletions src/libasr/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,8 +1685,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
llvm::Value* array = nullptr;
if( ASR::is_a<ASR::Var_t>(*x.m_v) ) {
ASR::Variable_t *v = ASRUtils::EXPR2VAR(x.m_v);
if( ASR::is_a<ASR::Struct_t>(*v->m_type) ) {
ASR::Struct_t* der_type = ASR::down_cast<ASR::Struct_t>(v->m_type);
if( ASR::is_a<ASR::Struct_t>(*ASRUtils::get_contained_type(v->m_type)) ) {
ASR::Struct_t* der_type = ASR::down_cast<ASR::Struct_t>(
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);
Expand Down Expand Up @@ -5968,7 +5969,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
builder0.SetInsertPoint(&entry_block, entry_block.getFirstInsertionPt());
llvm::AllocaInst *target = builder0.CreateAlloca(
target_type, nullptr, "call_arg_value");
if( ASR::is_a<ASR::ArrayItem_t>(*x.m_args[i].m_value) ) {
if( ASR::is_a<ASR::ArrayItem_t>(*x.m_args[i].m_value) ||
ASR::is_a<ASR::StructInstanceMember_t>(*x.m_args[i].m_value) ) {
value = CreateLoad(value);
}
if( ASR::is_a<ASR::Tuple_t>(*arg_type) ||
Expand Down
6 changes: 6 additions & 0 deletions src/libasr/pass/pass_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ASR::DoLoop_t&>(x);
transform_stmts(xx.m_body, xx.n_body);
}

};

template <class Struct>
Expand Down
2 changes: 1 addition & 1 deletion src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3082,7 +3082,7 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
if( is_item ) {
Vec<ASR::dimension_t> 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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-bindc_02-bc1a7ea.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-bindc_02-bc1a7ea.stdout
Original file line number Diff line number Diff line change
@@ -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.)}) [])
2 changes: 1 addition & 1 deletion tests/reference/asr-expr_12-6769be0.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/asr-expr_12-6769be0.stdout
Original file line number Diff line number Diff line change
@@ -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 () [] ())])}) [])