@@ -164,6 +164,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
164
164
bool emit_debug_info;
165
165
std::string infile;
166
166
bool emit_debug_line_column;
167
+ bool enable_bounds_checking;
167
168
Allocator &al;
168
169
169
170
llvm::Value *tmp;
@@ -242,14 +243,15 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
242
243
243
244
ASRToLLVMVisitor (Allocator &al, llvm::LLVMContext &context, Platform platform,
244
245
bool emit_debug_info, std::string infile, bool emit_debug_line_column,
245
- diag::Diagnostics &diagnostics) :
246
+ bool enable_bounds_checking, diag::Diagnostics &diagnostics) :
246
247
diag{diagnostics},
247
248
context (context),
248
249
builder (std::make_unique<llvm::IRBuilder<>>(context)),
249
250
platform{platform},
250
251
emit_debug_info{emit_debug_info},
251
252
infile{infile},
252
253
emit_debug_line_column{emit_debug_line_column},
254
+ enable_bounds_checking{enable_bounds_checking},
253
255
al{al},
254
256
prototype_only (false ),
255
257
llvm_utils (std::make_unique<LLVMUtils>(context, builder.get())),
@@ -1381,7 +1383,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
1381
1383
this ->visit_expr (*x.m_args [i]);
1382
1384
llvm::Value* item = tmp;
1383
1385
llvm::Value* pos = llvm::ConstantInt::get (context, llvm::APInt (32 , i));
1384
- list_api->write_item (const_list, pos, item, list_type->m_type , *module );
1386
+ list_api->write_item (const_list, pos, item, list_type->m_type , false , *module );
1385
1387
}
1386
1388
ptr_loads = ptr_loads_copy;
1387
1389
tmp = const_list;
@@ -1521,9 +1523,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
1521
1523
ptr_loads = ptr_loads_copy;
1522
1524
llvm::Value *pos = tmp;
1523
1525
1524
- tmp = list_api->read_item (plist, pos,
1525
- (LLVM::is_llvm_struct (el_type) ||
1526
- ptr_loads == 0 ));
1526
+ tmp = list_api->read_item (plist, pos, enable_bounds_checking, *module ,
1527
+ (LLVM::is_llvm_struct (el_type) || ptr_loads == 0 ));
1527
1528
}
1528
1529
1529
1530
void visit_DictItem (const ASR::DictItem_t& x) {
@@ -3916,7 +3917,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
3916
3917
llvm::Value* list = tmp;
3917
3918
this ->visit_expr_wrapper (asr_target0->m_pos , true );
3918
3919
llvm::Value* pos = tmp;
3919
- target = list_api->read_item (list, pos, true );
3920
+
3921
+ target = list_api->read_item (list, pos, enable_bounds_checking,
3922
+ *module , true );
3920
3923
}
3921
3924
} else {
3922
3925
ASR::Variable_t *asr_target = EXPR2VAR (x.m_target );
@@ -6399,7 +6402,7 @@ Result<std::unique_ptr<LLVMModule>> asr_to_llvm(ASR::TranslationUnit_t &asr,
6399
6402
context.setOpaquePointers (false );
6400
6403
#endif
6401
6404
ASRToLLVMVisitor v (al, context, co.platform , co.emit_debug_info , infile,
6402
- co.emit_debug_line_column , diagnostics);
6405
+ co.emit_debug_line_column , co. enable_bounds_checking , diagnostics);
6403
6406
LCompilers::PassOptions pass_options;
6404
6407
pass_options.run_fun = run_fn;
6405
6408
pass_options.always_run = false ;
0 commit comments