Skip to content

Commit 296b947

Browse files
committed
Array begin fix
1 parent fafef63 commit 296b947

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

integration_tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ endmacro(COMPILE)
417417

418418

419419
# Test zero and non-zero exit code and assert statements
420-
# RUN(NAME array_01_decl LABELS cpython llvm llvm_jit c)
421-
# RUN(NAME array_02_decl LABELS cpython llvm llvm_jit c)
420+
RUN(NAME array_01_decl LABELS cpython llvm llvm_jit c)
421+
RUN(NAME array_02_decl LABELS cpython llvm llvm_jit c)
422422
RUN(NAME array_03_decl LABELS cpython llvm llvm_jit) # renable c
423423
RUN(NAME variable_decl_01 LABELS cpython llvm llvm_jit c)
424424
RUN(NAME variable_decl_02 LABELS cpython llvm llvm_jit c)

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,10 +1891,12 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
18911891
ASR::ttype_t* type = get_type_from_var_annotation(var_annotation,
18921892
annotation.base.loc, dims, type_decl, m_args, n_args, raise_error, abi, is_argument);
18931893

1894+
ASR::expr_t* zero = ASRUtils::EXPR(ASR::make_IntegerConstant_t(al, loc, 0, ASRUtils::TYPE(
1895+
ASR::make_Integer_t(al, loc, 4))));
18941896
if (AST::is_a<AST::Slice_t>(*dim_info)) {
18951897
ASR::dimension_t dim;
18961898
dim.loc = loc;
1897-
dim.m_start = nullptr;
1899+
dim.m_start = zero;
18981900
dim.m_length = nullptr;
18991901
dims.push_back(al, dim);
19001902
} else if( is_runtime_array(dim_info) ) {
@@ -1903,7 +1905,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
19031905
if( AST::is_a<AST::Slice_t>(*tuple_multidim->m_elts[i]) ) {
19041906
ASR::dimension_t dim;
19051907
dim.loc = loc;
1906-
dim.m_start = nullptr;
1908+
dim.m_start = zero;
19071909
dim.m_length = nullptr;
19081910
dims.push_back(al, dim);
19091911
}

0 commit comments

Comments
 (0)