File tree 3 files changed +32
-0
lines changed
3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -573,6 +573,7 @@ RUN(NAME test_unary_op_04 LABELS cpython llvm c) # unary bitinvert
573
573
RUN(NAME test_unary_op_05 LABELS cpython llvm c) # unsigned unary minus, plus
574
574
RUN(NAME test_unary_op_06 LABELS cpython llvm c) # unsigned unary bitnot
575
575
RUN(NAME test_unsigned_01 LABELS cpython llvm c) # unsigned bitshift left, right
576
+ RUN(NAME test_unsigned_02 LABELS cpython llvm c)
576
577
RUN(NAME test_bool_binop LABELS cpython llvm c)
577
578
RUN(NAME test_issue_518 LABELS cpython llvm c NOFAST)
578
579
RUN(NAME structs_01 LABELS cpython llvm c)
Original file line number Diff line number Diff line change
1
+ from lpython import u16 , i32
2
+
3
+ # test issue 2170
4
+
5
+ i : i32
6
+ u : u16 = u16 (32768 )
7
+ x : i32
8
+
9
+ for i in range (i32 (u )):
10
+ x = i * 2
Original file line number Diff line number Diff line change @@ -2375,6 +2375,27 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
2375
2375
}
2376
2376
}
2377
2377
llvm_symtab[h] = ptr;
2378
+ } else if (x.m_type ->type == ASR::ttypeType::UnsignedInteger) {
2379
+ int a_kind = down_cast<ASR::UnsignedInteger_t>(x.m_type )->m_kind ;
2380
+ llvm::Type *type;
2381
+ int init_value_bits = 8 *a_kind;
2382
+ type = llvm_utils->getIntType (a_kind);
2383
+ llvm::Constant *ptr = module->getOrInsertGlobal (x.m_name ,
2384
+ type);
2385
+ if (!external) {
2386
+ if (ASRUtils::is_array (x.m_type )) {
2387
+ throw CodeGenError (" Arrays are not supported by visit_Variable" );
2388
+ }
2389
+ if (init_value) {
2390
+ module->getNamedGlobal (x.m_name )->setInitializer (
2391
+ init_value);
2392
+ } else {
2393
+ module->getNamedGlobal (x.m_name )->setInitializer (
2394
+ llvm::ConstantInt::get (context,
2395
+ llvm::APInt (init_value_bits, 0 )));
2396
+ }
2397
+ }
2398
+ llvm_symtab[h] = ptr;
2378
2399
} else if (x.m_type ->type == ASR::ttypeType::Real) {
2379
2400
int a_kind = down_cast<ASR::Real_t>(x.m_type )->m_kind ;
2380
2401
llvm::Type *type;
You can’t perform that action at this time.
0 commit comments