@@ -3907,15 +3907,12 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
39073907 ASR::ttype_t *int_type = ASRUtils::TYPE (ASR::make_Integer_t (
39083908 al, loc, 4 ));
39093909 ASR::expr_t *neg_idx = ASRUtils::expr_value (index);
3910- ASR::expr_t *dim_size;
3911- if (ASRUtils::extract_physical_type (type) != ASR::array_physical_typeType::DescriptorArray)
3912- dim_size = ASR::down_cast<ASR::Array_t>(type)->m_dims [idx].m_length ;
3913- else {
3914- ASR::expr_t *idx_expr = ASRUtils::EXPR (ASR::make_IntegerConstant_t (al, loc, idx + 1 , int_type));
3915- dim_size = ASRUtils::EXPR (ASRUtils::make_ArraySize_t_util (al, loc, value, idx_expr, int_type, nullptr , false ));
3916- }
3910+ // null if the dimension is not known at compile time
3911+ ASR::expr_t *dim_size = ASR::down_cast<ASR::Array_t>(type)->m_dims [idx].m_length ;
3912+ ASR::expr_t *idx_expr = ASRUtils::EXPR (ASR::make_IntegerConstant_t (al, loc, idx + 1 , int_type));
3913+ ASR::expr_t *size_expr = ASRUtils::EXPR (ASRUtils::make_ArraySize_t_util (al, loc, value, idx_expr, int_type, dim_size, false ));
39173914 index = ASRUtils::EXPR (ASR::make_IntegerBinOp_t (al, loc,
3918- dim_size , ASR::binopType::Add, neg_idx, int_type, nullptr ));
3915+ size_expr , ASR::binopType::Add, neg_idx, int_type, nullptr ));
39193916 }
39203917 }
39213918 } else {
0 commit comments