Skip to content

Commit

Permalink
Int initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
dpoerio committed Jun 3, 2021
1 parent b771283 commit d2c8abc
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/lfortran/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1540,9 +1540,10 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
nested_global_stack);
module->getNamedGlobal(nested_stack_name)->setInitializer(
initializer);
initializer = llvm::ConstantAggregateZero::get(sp);
llvm::ConstantInt *sp_init = llvm::ConstantInt::get(
module->getContext(), llvm::APInt(32,0));
module->getNamedGlobal(nested_sp_name)->setInitializer(
initializer);
sp_init);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-program_03-4a94021.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "llvm-program_03-4a94021.stdout",
"stdout_hash": "d14968d4a41980ccf48d68d18430ad327412eb3510de4b12e5bd6a30",
"stdout_hash": "b12616a0d1beb20751997b76d5a834492403bb9a549e48cc74ba55ad",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-program_03-4a94021.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source_filename = "LFortran"

@closuretest_nstd_strct = global %closuretest_nstd_types zeroinitializer
@closuretest_nstd_strct_stack = global [1000 x %closuretest_vals] zeroinitializer
@sp_closuretest = global i32 zeroinitializer
@sp_closuretest = global i32 0
@0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1

define i32 @add_z(i32* %x) {
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-recursion_01-2f4476d.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "llvm-recursion_01-2f4476d.stdout",
"stdout_hash": "9d5c72c8b72ba67eda9e36cdc3b5ed307d89a489807213e78795c6a1",
"stdout_hash": "d06cf76b208b72350037f48dd329133fdb83389119ff0b447e6783bf",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-recursion_01-2f4476d.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source_filename = "LFortran"
@n = global i32 0
@sub1_nstd_strct = global %sub1_nstd_types zeroinitializer
@sub1_nstd_strct_stack = global [1000 x %sub1_vals] zeroinitializer
@sp_sub1 = global i32 zeroinitializer
@sp_sub1 = global i32 0
@x = global i32 0
@0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@1 = private unnamed_addr constant [5 x i8] c"x = \00", align 1
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-recursion_02-89de428.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "llvm-recursion_02-89de428.stdout",
"stdout_hash": "4a4a2db2d18bd688525f0013ae2492660e48d6e3920f2b7bbc19ced6",
"stdout_hash": "6a7a8e6c96ac34c5d437b8d4a3811fd821322954dc56218eed4def92",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-recursion_02-89de428.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source_filename = "LFortran"

@sub1_nstd_strct = global %sub1_nstd_types zeroinitializer
@sub1_nstd_strct_stack = global [1000 x %sub1_vals] zeroinitializer
@sp_sub1 = global i32 zeroinitializer
@sp_sub1 = global i32 0
@0 = private unnamed_addr constant [8 x i8] c"before:\00", align 1
@1 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
@2 = private unnamed_addr constant [7 x i8] c"after:\00", align 1
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-recursion_03-dc86ba7.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outfile": null,
"outfile_hash": null,
"stdout": "llvm-recursion_03-dc86ba7.stdout",
"stdout_hash": "173153f326bf19307709220dc483d613a62b8c0e4520d95e27d94e80",
"stdout_hash": "818bfc7b7244473ebe52fc597b484b8ae999e104e5de186db2db6f71",
"stderr": null,
"stderr_hash": null,
"returncode": 0
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/llvm-recursion_03-dc86ba7.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source_filename = "LFortran"

@sub1_nstd_strct = global %sub1_nstd_types zeroinitializer
@sub1_nstd_strct_stack = global [1000 x %sub1_vals] zeroinitializer
@sp_sub1 = global i32 zeroinitializer
@sp_sub1 = global i32 0
@0 = private unnamed_addr constant [8 x i8] c"before:\00", align 1
@1 = private unnamed_addr constant [7 x i8] c"%s %d\0A\00", align 1
@2 = private unnamed_addr constant [7 x i8] c"after:\00", align 1
Expand Down

0 comments on commit d2c8abc

Please sign in to comment.