diff --git a/.gitignore b/.gitignore index 8c2e8ef7a8..27ef4cf771 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,9 @@ src/lfortran/tests/test_llvm src/lfortran/tests/test_parse src/lfortran/tests/test_pickle src/lfortran/tests/test_stacktrace* +src/lfortran/tests/test_serialization* src/lfortran/tests/test_cwrapper +src/lfortran/tests/test_serialization src/lfortran/tests/write32 src/lfortran/tests/write32.asm src/lfortran/tests/subroutines32 diff --git a/grammar/ASR.asdl b/grammar/ASR.asdl index 66295c188d..fedfebcd33 100644 --- a/grammar/ASR.asdl +++ b/grammar/ASR.asdl @@ -42,7 +42,7 @@ unit -- abi=Source means the symbol's implementation is included (full ASR), -- otherwise it is external (interface ASR, such as procedure interface). --- SubroutineCall/FuncCall store the actual final resolved subroutine or +-- SubroutineCall/FunctionCall store the actual final resolved subroutine or -- function (`name` member). They also store the original symbol -- (`original_name`), which can be one of: null, GenericProcedure or -- ExternalSymbol. @@ -60,6 +60,14 @@ unit -- used. After the ASR is loaded, the symbols that are used are represented as -- ExternalSymbols in the current scope of the symbol table. +-- ExternalSymbol represents symbols that cannot be looked up in the current +-- scoped symbol table. As an example, if a variable is defined in a module, +-- but used in a nested subroutine, that is not an external symbol +-- because it can be resolved in the current symbol table (nested subroutine) +-- by following the parents. However if a symbol is used from a different +-- module, then it is an external symbol, because usual symbol resolution by +-- going to the parents will not find the definition. + -- REPL: each cell is parsed into full ASR, compiled + executed, the full ASR -- is transformed into interface ASR (abi=LFortran) and kept in the symbol -- table. A new cell starts with an empty symbol table, whose parent symbol @@ -67,8 +75,10 @@ unit symbol - = Program(symbol_table symtab, identifier name, stmt* body) - | Module(symbol_table symtab, identifier name) + = Program(symbol_table symtab, identifier name, identifier* dependencies, + stmt* body) + | Module(symbol_table symtab, identifier name, identifier* dependencies, + bool loaded_from_mod) | Subroutine(symbol_table symtab, identifier name, expr* args, stmt* body, abi abi, access access) | Function(symbol_table symtab, identifier name, expr* args, stmt* body, @@ -76,7 +86,8 @@ symbol | GenericProcedure(symbol_table parent_symtab, identifier name, symbol* procs, access access) | ExternalSymbol(symbol_table parent_symtab, identifier name, - symbol external, access acess) + symbol external, identifier module_name, identifier original_name, + access access) | DerivedType(symbol_table symtab, identifier name, abi abi, access access) | Variable(symbol_table parent_symtab, identifier name, intent intent, expr? value, storage_type storage, ttype type, abi abi, access access) @@ -147,7 +158,7 @@ expr | StrOp(expr left, strop op, expr right, ttype type) | UnaryOp(unaryop op, expr operand, ttype type) | Compare(expr left, cmpop op, expr right, ttype type) - | FuncCall(symbol name, symbol? original_name, expr* args, + | FunctionCall(symbol name, symbol? original_name, expr* args, keyword* keywords, ttype type) | ArrayInitializer(expr* args, ttype type) | ConstantInteger(int n, ttype type) @@ -192,6 +203,7 @@ cast_kind | RealToComplex | IntegerToComplex | IntegerToLogical + | ComplexToComplex dimension = (expr? start, expr? end) diff --git a/grammar/AST.asdl b/grammar/AST.asdl index 13919835f0..20d5cf5670 100644 --- a/grammar/AST.asdl +++ b/grammar/AST.asdl @@ -70,6 +70,8 @@ stmt = Assignment(expr target, expr value) | Associate(expr target, expr value) | SubroutineCall(identifier name, fnarg* args, keyword* keywords) + | Allocate(fnarg* args, keyword* keywords) + | Deallocate(fnarg* args) | BuiltinCall(identifier name, expr* args) | If(expr test, stmt* body, stmt* orelse) | Where(expr test, stmt* body, stmt* orelse) diff --git a/grammar/asdl_cpp.py b/grammar/asdl_cpp.py index f8324796c5..4f82333517 100644 --- a/grammar/asdl_cpp.py +++ b/grammar/asdl_cpp.py @@ -367,33 +367,45 @@ def visitField(self, field): if (field.type not in asdl.builtin_types and field.type not in self.data.simple_types): level = 2 - if field.type in products: - if field.opt: - template = "self().visit_%s(*x.m_%s);" % (field.type, field.name) - else: - template = "self().visit_%s(x.m_%s);" % (field.type, field.name) - else: - template = "self().visit_%s(*x.m_%s);" % (field.type, field.name) - self.used = True if field.seq: + self.used = True self.emit("for (size_t i=0; iscope) {" % field.name, 2) + self.emit( "this->visit_symbol(*a.second);", 3) + self.emit("}", 2) class PickleVisitorVisitor(ASDLVisitor): def visitModule(self, mod): self.emit("/" + "*"*78 + "/") - self.emit("// Walk Visitor base class") + self.emit("// Pickle Visitor base class") self.emit("") self.emit("template ") self.emit("class PickleBaseVisitor : public BaseVisitor") @@ -642,6 +654,441 @@ def visitField(self, field, cons): +class SerializationVisitorVisitor(ASDLVisitor): + + def visitModule(self, mod): + self.emit("/" + "*"*78 + "/") + self.emit("// Serialization Visitor base class") + self.emit("") + self.emit("template ") + self.emit("class SerializationBaseVisitor : public BaseVisitor") + self.emit("{") + self.emit("private:") + self.emit( "Derived& self() { return static_cast(*this); }", 1) + self.emit("public:") + self.mod = mod + super(SerializationVisitorVisitor, self).visitModule(mod) + self.emit("};") + + def visitType(self, tp): + super(SerializationVisitorVisitor, self).visitType(tp, tp.name) + + def visitSum(self, sum, *args): + assert isinstance(sum, asdl.Sum) + if is_simple_sum(sum): + name = args[0] + "Type" + self.make_simple_sum_visitor(name, sum.types) + else: + for tp in sum.types: + self.visit(tp, *args) + + def visitProduct(self, prod, name): + self.make_visitor(name, prod.fields, False) + + def visitConstructor(self, cons, _): + self.make_visitor(cons.name, cons.fields, True) + + def make_visitor(self, name, fields, cons): + self.emit("void visit_%s(const %s_t &x) {" % (name, name), 1) + if cons: + self.emit( 'self().write_int8(x.base.type);', 2) + self.used = False + for n, field in enumerate(fields): + self.visitField(field, cons, name) + if not self.used: + # Note: a better solution would be to change `&x` to `& /* x */` + # above, but we would need to change emit to return a string. + self.emit("if ((bool&)x) { } // Suppress unused warning", 2) + self.emit("}", 1) + + def make_simple_sum_visitor(self, name, types): + self.emit("void visit_%s(const %s &x) {" % (name, name), 1) + self.emit( 'self().write_int8(x);', 2) + self.emit("}", 1) + + def visitField(self, field, cons, cons_name): + if (field.type not in asdl.builtin_types and + field.type not in self.data.simple_types): + self.used = True + level = 2 + if field.type in products: + if field.opt: + template = "self().visit_%s(*x.m_%s);" % (field.type, field.name) + else: + template = "self().visit_%s(x.m_%s);" % (field.type, field.name) + else: + if field.type == "symbol": + if cons_name == "ExternalSymbol": + template = "// We skip the symbol for ExternalSymbol" + else: + template = "self().write_symbol(*x.m_%s);" \ + % field.name + else: + template = "self().visit_%s(*x.m_%s);" % (field.type, field.name) + if field.seq: + self.emit('self().write_int64(x.n_%s);' % field.name, level) + self.emit("for (size_t i=0; itype);" % \ + field.name, level+1) + self.emit("self().visit_%s(*x.m_%s[i]);" % (mod_name, field.name), level+1) + self.emit("}", level) + elif field.type == "symbol_table": + assert not field.opt + assert not field.seq + # TODO: write the symbol table consistent with the reader: + if field.name == "parent_symtab": + level = 2 + self.emit('self().write_int64(x.m_%s->counter);' % field.name, level) + else: + level = 2 + self.emit('self().write_int64(x.m_%s->counter);' % field.name, level) + self.emit('self().write_int64(x.m_%s->scope.size());' % field.name, level) + self.emit('for (auto &a : x.m_%s->scope) {' % field.name, level) + self.emit(' self().write_string(a.first);', level) + self.emit(' this->visit_symbol(*a.second);', level) + self.emit('}', level) + elif field.type == "string" and not field.seq: + if field.opt: + self.emit("if (x.m_%s) {" % field.name, 2) + self.emit( 'self().write_bool(true);', 3) + self.emit( 'self().write_string(x.m_%s);' % field.name, 3) + self.emit("} else {", 2) + self.emit( 'self().write_bool(false);', 3) + self.emit("}", 2) + else: + self.emit('self().write_string(x.m_%s);' % field.name, 2) + elif field.type == "int" and not field.seq: + if field.opt: + self.emit("if (x.m_%s) {" % field.name, 2) + self.emit( 'self().write_bool(true);', 3) + self.emit( 'self().write_int64(x.m_%s);' % field.name, 3) + self.emit("} else {", 2) + self.emit( 'self().write_bool(false);', 3) + self.emit("}", 2) + else: + self.emit('self().write_int64(x.m_%s);' % field.name, 2) + elif field.type == "bool" and not field.seq and not field.opt: + self.emit("if (x.m_%s) {" % field.name, 2) + self.emit( 'self().write_bool(true);', 3) + self.emit("} else {", 2) + self.emit( 'self().write_bool(false);', 3) + self.emit("}", 2) + elif field.type in self.data.simple_types: + if field.opt: + raise Exception("Unimplemented opt for field type: " + field.type); + else: + self.emit('visit_%sType(x.m_%s);' \ + % (field.type, field.name), 2) + else: + raise Exception("Unimplemented field type: " + field.type); + +class DeserializationVisitorVisitor(ASDLVisitor): + + def visitModule(self, mod): + self.emit("/" + "*"*78 + "/") + self.emit("// Deserialization Visitor base class") + self.emit("") + self.emit("template ") + self.emit("class DeserializationBaseVisitor : public BaseVisitor") + self.emit("{") + self.emit("private:") + self.emit( "Derived& self() { return static_cast(*this); }", 1) + self.emit("public:") + self.emit( "Allocator &al;", 1) + self.emit( "bool load_symtab_id;", 1) + self.emit( "std::map id_symtab_map;", 1) + self.emit( r"DeserializationBaseVisitor(Allocator &al, bool load_symtab_id) : al{al}, load_symtab_id{load_symtab_id} {}", 1) + self.emit_deserialize_node(); + self.mod = mod + super(DeserializationVisitorVisitor, self).visitModule(mod) + self.emit("};") + + def visitType(self, tp): + super(DeserializationVisitorVisitor, self).visitType(tp, tp.name) + + def visitSum(self, sum, *args): + assert isinstance(sum, asdl.Sum) + if is_simple_sum(sum): + self.emit("%sType deserialize_%s() {" % (args[0], args[0]), 1) + self.emit( 'uint8_t t = self().read_int8();', 2) + self.emit( '%sType ty = static_cast<%sType>(t);' % (args[0], args[0]), 2) + self.emit( 'return ty;', 2) + self.emit("}", 1) + else: + for tp in sum.types: + self.visit(tp, *args) + self.emit("%s_t* deserialize_%s() {" % (subs["mod"], args[0]), 1) + self.emit( 'uint8_t t = self().read_int8();', 2) + self.emit( '%s::%sType ty = static_cast<%s::%sType>(t);' % (subs["mod"].upper(), args[0], + subs["mod"].upper(), args[0]), 2) + self.emit( 'switch (ty) {', 2) + for tp in sum.types: + self.emit( 'case (%s::%sType::%s) : return self().deserialize_%s();' \ + % (subs["mod"].upper(), args[0], tp.name, tp.name), 3) + self.emit( 'default : throw LFortranException("Unknown type in deserialize_%s()");' % args[0], 3) + self.emit( '}', 2) + self.emit( 'throw LFortranException("Switch statement above was not exhaustive.");', 2) + + self.emit("}", 1) + + def emit_deserialize_node(self): + name = "node" + self.emit("%s_t* deserialize_%s() {" % (subs["mod"], name), 1) + self.emit( 'uint8_t t = self().read_int8();', 2) + self.emit( '%s::%sType ty = static_cast<%s::%sType>(t);' % (subs["mod"].upper(), subs["mod"], + subs["mod"].upper(), subs["mod"]), 2) + self.emit( 'switch (ty) {', 2) + for tp in sums: + self.emit( 'case (%s::%sType::%s) : return self().deserialize_%s();' \ + % (subs["mod"].upper(), subs["mod"], tp, tp), 3) + self.emit( 'default : throw LFortranException("Unknown type in deserialize_%s()");' % name, 3) + self.emit( '}', 2) + self.emit( 'throw LFortranException("Switch statement above was not exhaustive.");', 2) + self.emit( '}', 1) + + def visitProduct(self, prod, name): + self.emit("%s_t deserialize_%s() {" % (name, name), 1) + self.emit( '%s_t x;' % (name), 2) + for field in prod.fields: + if field.seq: + assert not field.opt + assert field.type not in asdl.builtin_types + assert field.type not in simple_sums + self.emit('{', 2) + self.emit('uint64_t n = self().read_int64();', 3) + if field.type in products: + self.emit("Vec<%s_t> v;" % (field.type), 3) + else: + self.emit("Vec<%s_t*> v;" % (field.type), 3) + self.emit("v.reserve(al, n);", 3) + self.emit("for (uint64_t i=0; i(self().deserialize_%s()));" % (field.type, field.type), 4) + self.emit('}', 3) + self.emit('x.m_%s = v.p;' % (field.name), 3) + self.emit('x.n_%s = v.n;' % (field.name), 3) + self.emit('}', 2) + else: + self.emit('{', 2) + if field.opt: + self.emit("bool present=self().read_bool();", 3) + if field.type in asdl.builtin_types: + if field.type == "identifier": + rhs = "self().read_cstring()" + elif field.type == "string": + rhs = "self().read_cstring()" + else: + print(field.type) + assert False + elif field.type in simple_sums: + rhs = "deserialize_%s()" % (field.type) + else: + assert field.type not in products + rhs = "down_cast<%s_t>(deserialize_%s())" % (field.type, + field.type) + if field.opt: + self.emit('if (present) {', 3) + self.emit('x.m_%s = %s;' % (field.name, rhs), 4) + if field.opt: + self.emit('} else {', 3) + self.emit( 'x.m_%s = nullptr;' % (field.name), 4) + self.emit('}', 3) + self.emit('}', 2) + self.emit( 'return x;', 2) + self.emit("}", 1) + + def visitConstructor(self, cons, _): + name = cons.name + self.emit("%s_t* deserialize_%s() {" % (subs["mod"], name), 1) + lines = [] + args = ["al", "loc"] + for f in cons.fields: + #type_ = convert_type(f.type, f.seq, f.opt, self.mod.name.lower()) + if f.seq: + seq = "size_t n_%s; // Sequence" % f.name + self.emit("%s" % seq, 2) + else: + seq = "" + if f.seq: + assert f.type not in self.data.simple_types + if f.type not in asdl.builtin_types: + lines.append("n_%s = self().read_int64();" % (f.name)) + if f.type in products: + lines.append("Vec<%s_t> v_%s;" % (f.type, f.name)) + else: + lines.append("Vec<%s_t*> v_%s;" % (f.type, f.name)) + lines.append("v_%s.reserve(al, n_%s);" % (f.name, f.name)) + lines.append("for (size_t i=0; i(self().deserialize_%s()));" % (f.name, + subs["mod"].upper(), subs["mod"].upper(), f.type, f.type)) + lines.append("}") + else: + if f.type == "node": + lines.append("n_%s = self().read_int64();" % (f.name)) + lines.append("Vec<%s_t*> v_%s;" % (subs["mod"], f.name)) + lines.append("v_%s.reserve(al, n_%s);" % (f.name, f.name)) + lines.append("for (size_t i=0; i v_%s;" % (f.name)) + lines.append("v_%s.reserve(al, n_%s);" % (f.name, f.name)) + lines.append("for (size_t i=0; i(nullptr);" % (f.name)) + lines.append("if (load_symtab_id) m_%s->counter = m_%s_counter;" % (f.name, f.name)) + lines.append("id_symtab_map[m_%s_counter] = m_%s;" % (f.name, f.name)) + lines.append("{") + lines.append(" size_t n = self().read_int64();") + lines.append(" for (size_t i=0; i(deserialize_symbol());") + lines.append(" self().symtab_insert_symbol(*m_%s, name, sym);" % f.name) + lines.append(" }") + lines.append("}") + else: + print(f.type) + assert False + else: + if f.type in products: + assert not f.opt + lines.append("%s::%s_t m_%s = self().deserialize_%s();" % (subs["mod"].upper(), f.type, f.name, f.type)) + else: + if f.type in simple_sums: + assert not f.opt + lines.append("%s::%sType m_%s = self().deserialize_%s();" % (subs["mod"].upper(), + f.type, f.name, f.type)) + else: + lines.append("%s::%s_t *m_%s;" % (subs["mod"].upper(), + f.type, f.name)) + if f.opt: + lines.append("if (self().read_bool()) {") + if f.type == "symbol": + if name == "ExternalSymbol": + lines.append("// We skip the symbol for ExternalSymbol") + lines.append("m_%s = nullptr;" % (f.name)) + else: + lines.append("m_%s = self().read_symbol();" % (f.name)) + else: + lines.append("m_%s = %s::down_cast<%s::%s_t>(self().deserialize_%s());" % ( + f.name, subs["mod"].upper(), subs["mod"].upper(), f.type, f.type)) + if f.opt: + lines.append("} else {") + lines.append("m_%s = nullptr;" % f.name) + lines.append("}") + args.append("m_%s" % (f.name)) + for line in lines: + self.emit(line, 2) + + self.emit( 'Location loc;', 2) + self.emit( 'return %s::make_%s_t(%s);' % (subs["mod"].upper(), name, ", ".join(args)), 2) + self.emit("}", 1) + + class ASDLData(object): def __init__(self, tree): @@ -697,6 +1144,7 @@ def add_masks(fields, node): #include #include #include +#include #include #include @@ -751,7 +1199,8 @@ def add_masks(fields, node): visitors = [ASTNodeVisitor0, ASTNodeVisitor1, ASTNodeVisitor, ASTVisitorVisitor1, ASTVisitorVisitor1b, ASTVisitorVisitor2, - ASTWalkVisitorVisitor, PickleVisitorVisitor] + ASTWalkVisitorVisitor, PickleVisitorVisitor, + SerializationVisitorVisitor, DeserializationVisitorVisitor] def main(argv): diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index a3f7930cc9..81ff118d40 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -37,7 +37,7 @@ message("LFORTRAN_BACKEND: ${LFORTRAN_BACKEND}") macro(RUN) set(options FAIL) set(oneValueArgs NAME) - set(multiValueArgs LABELS) + set(multiValueArgs LABELS EXTRAFILES) cmake_parse_arguments(RUN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) set(name ${RUN_NAME}) @@ -58,7 +58,7 @@ macro(RUN) endif() if (ADD_TEST) - add_executable(${name} ${name}.f90) + add_executable(${name} ${name}.f90 ${RUN_EXTRAFILES}) if ((LFORTRAN_BACKEND STREQUAL "cpp") OR (LFORTRAN_BACKEND STREQUAL "x86")) target_compile_options(${name} PUBLIC --backend=${LFORTRAN_BACKEND}) target_link_options(${name} PUBLIC --backend=${LFORTRAN_BACKEND}) @@ -107,6 +107,7 @@ RUN(NAME while_02 LABELS gfortran llvm cpp) RUN(NAME doloop_01 LABELS gfortran llvm cpp x86) RUN(NAME doloop_02 LABELS gfortran llvm cpp x86) RUN(NAME doloop_03 LABELS gfortran llvm cpp) +RUN(NAME doloop_05 LABELS gfortran llvm cpp) RUN(NAME subroutines_01 LABELS gfortran llvm cpp x86) RUN(NAME subroutines_02 LABELS gfortran llvm cpp x86) @@ -155,6 +156,12 @@ RUN(NAME modules_03 LABELS gfortran) RUN(NAME modules_04 LABELS gfortran) RUN(NAME modules_05 LABELS gfortran) RUN(NAME modules_06 LABELS gfortran llvm) +RUN(NAME modules_07 LABELS gfortran llvm EXTRAFILES modules_07_module.f90) +RUN(NAME modules_08 LABELS gfortran llvm EXTRAFILES + modules_08_a.f90 modules_08_b.f90) +RUN(NAME modules_09 LABELS gfortran llvm EXTRAFILES + modules_09_a.f90 modules_09_b.f90) +RUN(NAME modules_10 LABELS gfortran llvm) RUN(NAME if_04 LABELS gfortran x86) RUN(NAME case_01 LABELS gfortran llvm) @@ -222,6 +229,9 @@ RUN(NAME const_real_dp LABELS gfortran llvm) RUN(NAME real_dp_param LABELS gfortran llvm) RUN(NAME int_dp LABELS gfortran llvm) RUN(NAME int_dp_param LABELS gfortran llvm) +RUN(NAME complex_dp LABELS gfortran llvm) +RUN(NAME bin_op_complex_dp LABELS gfortran llvm) +RUN(NAME complex_dp_param LABELS gfortran llvm) RUN(NAME string1 LABELS gfortran llvm) RUN(NAME string2 LABELS gfortran llvm) diff --git a/integration_tests/allocate_01.f90 b/integration_tests/allocate_01.f90 index 880461dcfb..c2f57d2aa1 100644 --- a/integration_tests/allocate_01.f90 +++ b/integration_tests/allocate_01.f90 @@ -1,9 +1,9 @@ program allocate_01 implicit none real, allocatable :: a(:), b(:,:), c(:,:,:) -integer :: n +integer :: n, ierr n = 10 allocate(a(5)) -allocate(b(n,n), c(n, 5, n)) +allocate(b(n,n), c(n, 5, n), stat=ierr) deallocate(a, c) end diff --git a/integration_tests/arrays_06.f90 b/integration_tests/arrays_06.f90 index ed80fbda2d..8f891ea660 100644 --- a/integration_tests/arrays_06.f90 +++ b/integration_tests/arrays_06.f90 @@ -1,7 +1,13 @@ program arrays_06 implicit none -real, dimension(5) :: x +real, dimension(6) :: x integer :: i -x = [(i*2, i = 1, 5)] +x = [(i*2, i = 1, 6)] +print *, x +x = [(i+1, i*2, i = 1, 3)] +print *, x +x = [(i+1, i**2, i*2, i = 1, 2)] +print *, x +x = [(2*i, 3*i, 4*i, i+1, i**2, i*2, i = 2, 2)] print *, x end program diff --git a/integration_tests/bin_op_complex_dp.f90 b/integration_tests/bin_op_complex_dp.f90 new file mode 100644 index 0000000000..51660e6ed9 --- /dev/null +++ b/integration_tests/bin_op_complex_dp.f90 @@ -0,0 +1,12 @@ +program bin_op_complex_dp + + complex(4) :: zero + complex(8) :: v, u + complex :: x + zero = 1.0_4/7 + u = 1.0_4/7 + v = 1.0_8/7 + x = 1.0_4/7 + print *, zero, v, x, u + +end program \ No newline at end of file diff --git a/integration_tests/complex_dp.f90 b/integration_tests/complex_dp.f90 new file mode 100644 index 0000000000..f240ec57b1 --- /dev/null +++ b/integration_tests/complex_dp.f90 @@ -0,0 +1,11 @@ +program complex_dp + + complex(4) :: zero + complex(8) :: v + complex :: x + zero = 0.0_4 + v = (1.05_4, 1.05_4) + x = (1.05_4, 1.05_8) + print *, v, x, zero + +end program \ No newline at end of file diff --git a/integration_tests/complex_dp_param.f90 b/integration_tests/complex_dp_param.f90 new file mode 100644 index 0000000000..057cec8ae2 --- /dev/null +++ b/integration_tests/complex_dp_param.f90 @@ -0,0 +1,9 @@ +program complex_dp_param + + integer, parameter :: prec1 = 4, prec2 = 8 + complex(prec1) :: u = (1.05, 1.05) + complex(prec2) :: v = (1.05, 1.05_8) + complex(prec2) :: zero = 0.0_4 + print *, u, v, zero + +end program \ No newline at end of file diff --git a/integration_tests/doloop_05.f90 b/integration_tests/doloop_05.f90 new file mode 100644 index 0000000000..a67948d3a1 --- /dev/null +++ b/integration_tests/doloop_05.f90 @@ -0,0 +1,10 @@ +program doloop_05 +implicit none +integer :: i, j +j = 0 +i_loop: do i = 1, 10 + if (i == 2) cycle i_loop + j = j + i +end do i_loop +if (j /= 53) error stop +end diff --git a/integration_tests/interface_01.f90 b/integration_tests/interface_01.f90 index 0050ca77af..d7d136e7be 100644 --- a/integration_tests/interface_01.f90 +++ b/integration_tests/interface_01.f90 @@ -35,4 +35,8 @@ program interface_01 call a(r) if (r /= 7) error stop +i = 7 +call a(i) +if (i /= 8) error stop + end program diff --git a/integration_tests/modules_01.f90 b/integration_tests/modules_01.f90 index 22fb794617..0becbd1e14 100644 --- a/integration_tests/modules_01.f90 +++ b/integration_tests/modules_01.f90 @@ -1,4 +1,4 @@ -module a +module a_01 implicit none contains @@ -10,7 +10,7 @@ subroutine b() end module program modules_01 -use a, only: b +use a_01, only: b implicit none call b() diff --git a/integration_tests/modules_02.f90 b/integration_tests/modules_02.f90 index b11e1d3c16..f8c3a9e4c0 100644 --- a/integration_tests/modules_02.f90 +++ b/integration_tests/modules_02.f90 @@ -1,4 +1,4 @@ -module a +module a_02 implicit none contains @@ -9,7 +9,7 @@ subroutine b() end module -module c +module c_02 implicit none contains @@ -18,14 +18,20 @@ subroutine d() print *, "d()" end subroutine +subroutine e() +print *, "e()" +end subroutine + end module program modules_02 -use a -use c, only: x=>d +use a_02 +use c_02, only: x=>d +use c_02, only: e implicit none call b() call x() +call e() end diff --git a/integration_tests/modules_04.f90 b/integration_tests/modules_04.f90 index 3de03352ed..dff0173590 100644 --- a/integration_tests/modules_04.f90 +++ b/integration_tests/modules_04.f90 @@ -1,4 +1,4 @@ -module a +module a_04 implicit none contains @@ -18,12 +18,12 @@ program modules_04 contains subroutine f() - use a, only: b + use a_04, only: b call b() end subroutine integer function g() - use :: a, only: b + use :: a_04, only: b call b() g = 5 end function diff --git a/integration_tests/modules_06.f90 b/integration_tests/modules_06.f90 index ee053f967e..848c2574d1 100644 --- a/integration_tests/modules_06.f90 +++ b/integration_tests/modules_06.f90 @@ -1,4 +1,4 @@ -module a +module a_06 implicit none contains @@ -11,7 +11,7 @@ integer function b() result(r) end module program modules_06 -use a, only: b +use a_06, only: b implicit none integer :: i diff --git a/integration_tests/modules_07.f90 b/integration_tests/modules_07.f90 new file mode 100644 index 0000000000..8e6bdc6c2a --- /dev/null +++ b/integration_tests/modules_07.f90 @@ -0,0 +1,7 @@ +program modules_07 +use modules_07_module, only: b +implicit none + +call b() + +end diff --git a/integration_tests/modules_07_module.f90 b/integration_tests/modules_07_module.f90 new file mode 100644 index 0000000000..ccf1ff583e --- /dev/null +++ b/integration_tests/modules_07_module.f90 @@ -0,0 +1,10 @@ +module modules_07_module +implicit none + +contains + +subroutine b() +print *, "b()" +end subroutine + +end module diff --git a/integration_tests/modules_08.f90 b/integration_tests/modules_08.f90 new file mode 100644 index 0000000000..ec4a845c82 --- /dev/null +++ b/integration_tests/modules_08.f90 @@ -0,0 +1,11 @@ +program modules_08 +use modules_08_a, only: a +use modules_08_b, only: b +implicit none + +if (a() /= 3) error stop +if (b() /= 5) error stop + +print *, "OK" + +end diff --git a/integration_tests/modules_08_a.f90 b/integration_tests/modules_08_a.f90 new file mode 100644 index 0000000000..685664f1cc --- /dev/null +++ b/integration_tests/modules_08_a.f90 @@ -0,0 +1,12 @@ +module modules_08_a +implicit none +private +public a + +contains + +integer function a() +a = 3 +end function + +end module diff --git a/integration_tests/modules_08_b.f90 b/integration_tests/modules_08_b.f90 new file mode 100644 index 0000000000..e13408c145 --- /dev/null +++ b/integration_tests/modules_08_b.f90 @@ -0,0 +1,12 @@ +module modules_08_b +implicit none +private +public b + +contains + +integer function b() +b = 5 +end function + +end module diff --git a/integration_tests/modules_09.f90 b/integration_tests/modules_09.f90 new file mode 100644 index 0000000000..687f4fdaa1 --- /dev/null +++ b/integration_tests/modules_09.f90 @@ -0,0 +1,9 @@ +program modules_09 +use modules_09_a, only: a +implicit none + +if (a() /= 8) error stop + +print *, "OK" + +end diff --git a/integration_tests/modules_09_a.f90 b/integration_tests/modules_09_a.f90 new file mode 100644 index 0000000000..1a559647ab --- /dev/null +++ b/integration_tests/modules_09_a.f90 @@ -0,0 +1,13 @@ +module modules_09_a +use modules_09_b, only: b +implicit none +private +public a + +contains + +integer function a() +a = 3 + b() +end function + +end module diff --git a/integration_tests/modules_09_b.f90 b/integration_tests/modules_09_b.f90 new file mode 100644 index 0000000000..bb90d095ed --- /dev/null +++ b/integration_tests/modules_09_b.f90 @@ -0,0 +1,12 @@ +module modules_09_b +implicit none +private +public b + +contains + +integer function b() +b = 5 +end function + +end module diff --git a/integration_tests/modules_10.f90 b/integration_tests/modules_10.f90 new file mode 100644 index 0000000000..8c3b112772 --- /dev/null +++ b/integration_tests/modules_10.f90 @@ -0,0 +1,27 @@ +module modules_10_b +implicit none +private +public b +contains + integer function b() + b = 5 + end function +end module + +module modules_10_a +use modules_10_b, only: b +implicit none +private +public a +contains + integer function a() + a = 3 + b() + end function +end module + +program modules_10 +use modules_10_a, only: a +implicit none +if (a() /= 8) error stop +print *, "OK" +end diff --git a/src/bin/lfortran.cpp b/src/bin/lfortran.cpp index e447e00830..a8f7a8e1df 100644 --- a/src/bin/lfortran.cpp +++ b/src/bin/lfortran.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -493,12 +495,37 @@ int save_mod_files(const LFortran::ASR::TranslationUnit_t &u) for (auto &item : u.m_global_scope->scope) { if (LFortran::ASR::is_a(*item.second)) { LFortran::ASR::Module_t *m = LFortran::ASR::down_cast(item.second); + + // Do not save modfiles for modules that were already loaded + // from modfiles (as full ASR) + if (m->m_loaded_from_mod) continue; + + Allocator al(4*1024); + LFortran::SymbolTable *symtab = + al.make_new(nullptr); + symtab->scope[std::string(m->m_name)] = item.second; + LFortran::SymbolTable *orig_symtab = m->m_symtab->parent; + m->m_symtab->parent = symtab; + + LFortran::Location loc; + LFortran::ASR::asr_t *asr = LFortran::ASR::make_TranslationUnit_t(al, loc, + symtab, nullptr, 0); + LFortran::ASR::TranslationUnit_t *tu = + LFortran::ASR::down_cast2(asr); + LFORTRAN_ASSERT(LFortran::asr_verify(*tu)); + + std::string modfile_binary = LFortran::save_modfile(*tu); + + m->m_symtab->parent = orig_symtab; + + LFORTRAN_ASSERT(LFortran::asr_verify(u)); + + std::string modfile = std::string(m->m_name) + ".mod"; - std::string cmd = "touch " + modfile; - int err = system(cmd.c_str()); - if (err) { - std::cout << "The command '" + cmd + "' failed." << std::endl; - return 11; + { + std::ofstream out; + out.open(modfile); + out << modfile_binary; } } } @@ -549,7 +576,7 @@ int compile_to_object_file(const std::string &infile, const std::string &outfile LFortran::ASR::TranslationUnit_t* asr; - // Src -> AST + // Src -> AST -> ASR LFortran::FortranEvaluator::Result result = fe.get_asr2(input); if (result.ok) { @@ -568,6 +595,17 @@ int compile_to_object_file(const std::string &infile, const std::string &outfile if (err) return err; } + if (!LFortran::main_program_present(*asr)) { + // Create an empty object file (things will be actually + // compiled and linked when the main program is present): + { + std::ofstream out; + out.open(outfile); + out << " "; + } + return 0; + } + // ASR -> LLVM LFortran::LLVMEvaluator e; std::unique_ptr m; @@ -798,7 +836,7 @@ int link_executable(const std::string &infile, const std::string &outfile, } else { CC = "gcc"; } - std::string base_path = runtime_library_dir; + std::string base_path = "\"" + runtime_library_dir + "\""; std::string options; std::string runtime_lib = "lfortran_runtime"; if (static_executable) { @@ -919,7 +957,7 @@ int main(int argc, char *argv[]) std::vector arg_I; bool arg_cpp = false; std::string arg_o; - std::string arg_file; + std::vector arg_files; bool arg_version = false; bool show_tokens = false; bool show_ast = false; @@ -950,7 +988,7 @@ int main(int argc, char *argv[]) CLI::App app{"LFortran: modern interactive LLVM-based Fortran compiler"}; // Standard options compatible with gfortran, gcc or clang // We follow the established conventions - app.add_option("file", arg_file, "Source file"); + app.add_option("files", arg_files, "Source files"); app.add_flag("-S", arg_S, "Emit assembly, do not assemble or link"); app.add_flag("-c", arg_c, "Compile and assemble, do not link"); app.add_option("-o", arg_o, "Specify the file to place the output into"); @@ -1052,7 +1090,7 @@ int main(int argc, char *argv[]) return 1; } - if (arg_file.size() == 0) { + if (arg_files.size() == 0) { #ifdef HAVE_LFORTRAN_LLVM return prompt(arg_v); #else @@ -1061,6 +1099,10 @@ int main(int argc, char *argv[]) #endif } + // TODO: for now we ignore the other filenames, only handle + // the first: + std::string arg_file = arg_files[0]; + std::string outfile; std::string basename; basename = remove_extension(arg_file); diff --git a/src/lfortran/CMakeLists.txt b/src/lfortran/CMakeLists.txt index 4932917c72..237e6b9c12 100644 --- a/src/lfortran/CMakeLists.txt +++ b/src/lfortran/CMakeLists.txt @@ -16,7 +16,11 @@ set(SRC pass/global_stmts.cpp pass/select_case.cpp + asr_verify.cpp + asr_utils.cpp + modfile.cpp pickle.cpp + serialization.cpp cwrapper.cpp ast_to_src.cpp diff --git a/src/lfortran/asr_utils.cpp b/src/lfortran/asr_utils.cpp new file mode 100644 index 0000000000..8dedd17539 --- /dev/null +++ b/src/lfortran/asr_utils.cpp @@ -0,0 +1,79 @@ +#include + +namespace LFortran { + +void visit(int a, std::map> &deps, + std::vector &visited, std::vector &result) { + visited[a] = true; + for (auto n : deps[a]) { + if (!visited[n]) visit(n, deps, visited, result); + } + result.push_back(a); +} + +std::vector order_deps(std::map> &deps) { + std::vector visited(deps.size(), false); + std::vector result; + for (auto d : deps) { + if (!visited[d.first]) visit(d.first, deps, visited, result); + } + return result; +} + +std::vector order_deps(std::map> &deps) { + // Create a mapping string <-> int + std::vector int2string; + std::map string2int; + for (auto d : deps) { + if (string2int.find(d.first) == string2int.end()) { + string2int[d.first] = int2string.size(); + int2string.push_back(d.first); + } + for (auto n : d.second) { + if (string2int.find(n) == string2int.end()) { + string2int[n] = int2string.size(); + int2string.push_back(n); + } + } + } + + // Transform dep -> dep_int + std::map> deps_int; + for (auto d : deps) { + deps_int[string2int[d.first]] = std::vector(); + for (auto n : d.second) { + deps_int[string2int[d.first]].push_back(string2int[n]); + } + } + + // Compute ordering + std::vector result_int = order_deps(deps_int); + + // Transform result_int -> result + std::vector result; + for (auto n : result_int) { + result.push_back(int2string[n]); + } + + return result; +} + +std::vector determine_module_dependencies( + const ASR::TranslationUnit_t &unit) +{ + std::map> deps; + for (auto &item : unit.m_global_scope->scope) { + if (ASR::is_a(*item.second)) { + std::string name = item.first; + ASR::Module_t *m = ASR::down_cast(item.second); + deps[name] = std::vector(); + for (size_t i=0; i < m->n_dependencies; i++) { + std::string dep = m->m_dependencies[i]; + deps[name].push_back(dep); + } + } + } + return order_deps(deps); +} + +} // namespace LFortran diff --git a/src/lfortran/asr_utils.h b/src/lfortran/asr_utils.h index 8dd37a24f9..c9d16d2d41 100644 --- a/src/lfortran/asr_utils.h +++ b/src/lfortran/asr_utils.h @@ -38,7 +38,7 @@ static inline ASR::ttype_t* expr_type(const ASR::expr_t *f) case ASR::exprType::BinOp: { return ((ASR::BinOp_t*)f)->m_type; } case ASR::exprType::UnaryOp: { return ((ASR::UnaryOp_t*)f)->m_type; } case ASR::exprType::Compare: { return ((ASR::Compare_t*)f)->m_type; } - case ASR::exprType::FuncCall: { return ((ASR::FuncCall_t*)f)->m_type; } + case ASR::exprType::FunctionCall: { return ((ASR::FunctionCall_t*)f)->m_type; } case ASR::exprType::ArrayRef: { return ((ASR::ArrayRef_t*)f)->m_type; } case ASR::exprType::ArrayInitializer: { return ((ASR::ArrayInitializer_t*)f)->m_type; } case ASR::exprType::ConstantInteger: { return ((ASR::ConstantInteger_t*)f)->m_type; } @@ -127,6 +127,34 @@ static inline bool is_arg_dummy(int intent) { || intent == intent_inout; } +static inline const ASR::symbol_t *symbol_get_past_external(const ASR::symbol_t *f) +{ + if (f->type == ASR::symbolType::ExternalSymbol) { + ASR::ExternalSymbol_t *e = ASR::down_cast(f); + LFORTRAN_ASSERT(!ASR::is_a(*e->m_external)); + return e->m_external; + } else { + return f; + } +} + +static inline bool main_program_present(const ASR::TranslationUnit_t &unit) +{ + for (auto &a : unit.m_global_scope->scope) { + if (ASR::is_a(*a.second)) return true; + } + return false; +} + +// Accepts dependencies in the form A -> [B, D, ...], B -> [C, D] +// Returns a list of dependencies in the order that they should be built: +// [D, C, B, A] +std::vector order_deps(std::map> &deps); +std::vector order_deps(std::map> &deps); + +std::vector determine_module_dependencies( + const ASR::TranslationUnit_t &unit); } // namespace LFortran diff --git a/src/lfortran/asr_verify.cpp b/src/lfortran/asr_verify.cpp new file mode 100644 index 0000000000..fdaf51ff8e --- /dev/null +++ b/src/lfortran/asr_verify.cpp @@ -0,0 +1,272 @@ +#include +#include +#include +#include + + +namespace LFortran { +namespace ASR { + +class VerifyVisitor : public BaseWalkVisitor +{ +private: + // For checking correct parent symbtab relationship + SymbolTable *current_symtab; + + // For checking that all symtabs have a unique ID. + // We first walk all symtabs, and then we check that everything else + // points to them (i.e., that nothing points to some symbol table that + // is not part of this ASR). + std::map id_symtab_map; + bool check_external; +public: + VerifyVisitor(bool check_external) : check_external{check_external} {} + + // Requires the condition `cond` to be true. Raise an exception otherwise. + void require(bool cond, const std::string &error_msg) { + if (!cond) { + throw LFortranException("ASR verify failed: " + error_msg); + } + } + + // Returns true if the `symtab_ID` is the current symbol table `symtab` or + // any of its parents. It returns false otherwise, such as in the case when + // the symtab is in a different module. + bool symtab_in_scope(const SymbolTable *symtab, unsigned int symtab_ID) { + const SymbolTable *s = symtab; + while (s != nullptr) { + if (s->counter == symtab_ID) return true; + s = s->parent; + } + return false; + } + + void visit_TranslationUnit(const TranslationUnit_t &x) { + current_symtab = x.m_global_scope; + require(x.m_global_scope != nullptr, + "The TranslationUnit::m_global_scope cannot be nullptr"); + require(x.m_global_scope->parent == nullptr, + "The TranslationUnit::m_global_scope->parent must be nullptr"); + require(id_symtab_map.find(x.m_global_scope->counter) == id_symtab_map.end(), + "TranslationUnit::m_global_scope->counter must be unique"); + id_symtab_map[x.m_global_scope->counter] = x.m_global_scope; + for (auto &a : x.m_global_scope->scope) { + this->visit_symbol(*a.second); + } + for (size_t i=0; i(*item) || is_a(*item), + "TranslationUnit::m_items must be either stmt or expr"); + } + current_symtab = nullptr; + } + + // -------------------------------------------------------- + // symbol instances: + + void visit_Program(const Program_t &x) { + SymbolTable *parent_symtab = current_symtab; + current_symtab = x.m_symtab; + require(x.m_symtab != nullptr, + "The Program::m_symtab cannot be nullptr"); + require(x.m_symtab->parent == parent_symtab, + "The Program::m_symtab->parent is not the right parent"); + require(x.m_symtab->parent->parent == nullptr, + "The Program::m_symtab's parent must be TranslationUnit"); + require(id_symtab_map.find(x.m_symtab->counter) == id_symtab_map.end(), + "Program::m_symtab->counter must be unique"); + id_symtab_map[x.m_symtab->counter] = x.m_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + for (size_t i=0; iparent == parent_symtab, + "The Module::m_symtab->parent is not the right parent"); + require(x.m_symtab->parent->parent == nullptr, + "The Module::m_symtab's parent must be TranslationUnit"); + require(id_symtab_map.find(x.m_symtab->counter) == id_symtab_map.end(), + "Module::m_symtab->counter must be unique"); + id_symtab_map[x.m_symtab->counter] = x.m_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + current_symtab = parent_symtab; + } + + void visit_Subroutine(const Subroutine_t &x) { + SymbolTable *parent_symtab = current_symtab; + current_symtab = x.m_symtab; + require(x.m_symtab != nullptr, + "The Subroutine::m_symtab cannot be nullptr"); + require(x.m_symtab->parent == parent_symtab, + "The Subroutine::m_symtab->parent is not the right parent"); + require(id_symtab_map.find(x.m_symtab->counter) == id_symtab_map.end(), + "Subroutine::m_symtab->counter must be unique"); + id_symtab_map[x.m_symtab->counter] = x.m_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + for (size_t i=0; iparent == parent_symtab, + "The Function::m_symtab->parent is not the right parent"); + require(id_symtab_map.find(x.m_symtab->counter) == id_symtab_map.end(), + "Function::m_symtab->counter must be unique"); + id_symtab_map[x.m_symtab->counter] = x.m_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + for (size_t i=0; iparent == parent_symtab, + "The DerivedType::m_symtab->parent is not the right parent"); + require(id_symtab_map.find(x.m_symtab->counter) == id_symtab_map.end(), + "Derivedtype::m_symtab->counter must be unique"); + id_symtab_map[x.m_symtab->counter] = x.m_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + current_symtab = parent_symtab; + } + + void visit_Variable(const Variable_t &x) { + SymbolTable *symtab = x.m_parent_symtab; + require(symtab != nullptr, + "Variable::m_parent_symtab cannot be nullptr"); + require(symtab->scope.find(std::string(x.m_name)) != symtab->scope.end(), + "Variable not found in parent_symtab symbol table"); + symbol_t *symtab_sym = symtab->scope[std::string(x.m_name)]; + const symbol_t *current_sym = &x.base; + require(symtab_sym == current_sym, + "Variable's parent symbol table does not point to it"); + require(id_symtab_map.find(symtab->counter) != id_symtab_map.end(), + "Variable::m_parent_symtab must be present in the ASR"); + + if (x.m_value) + visit_expr(*x.m_value); + visit_ttype(*x.m_type); + } + + void visit_ExternalSymbol(const ExternalSymbol_t &x) { + if (check_external) { + require(x.m_external != nullptr, + "ExternalSymbol::m_external cannot be nullptr"); + require(!is_a(*x.m_external), + "ExternalSymbol::m_external cannot be an ExternalSymbol"); + char *orig_name = symbol_name(x.m_external); + require(std::string(x.m_original_name) == std::string(orig_name), + "ExternalSymbol::m_original_name must match external->m_name"); + // TODO: check that module name matches x.m_module_name + } + } + + // -------------------------------------------------------- + // nodes that have symbol in their fields: + + void visit_Var(const Var_t &x) { + require(x.m_v != nullptr, + "Var_t::m_v cannot be nullptr"); + require(is_a(*x.m_v), + "Var_t::m_v does not point to a Variable_t"); + require(symtab_in_scope(current_symtab, + symbol_parent_symtab(x.m_v)->counter), + "Var::m_v cannot point outside of its symbol table"); + } + + void visit_ArrayRef(const ArrayRef_t &x) { + require(symtab_in_scope(current_symtab, + symbol_parent_symtab(x.m_v)->counter), + "ArrayRef::m_v cannot point outside of its symbol table"); + for (size_t i=0; icounter), + "SubroutineCall::m_name cannot point outside of its symbol table"); + for (size_t i=0; icounter), + "FunctionCall::m_name cannot point outside of its symbol table"); + for (size_t i=0; icounter), + "Derived::m_derived_type cannot point outside of its symbol table"); + for (size_t i=0; icounter), + "DerivedPointer::m_derived_type cannot point outside of its symbol table"); + for (size_t i=0; i + +namespace LFortran { + + // Verifies that ASR is correctly constructed and contains valid Fortran + // code and passes all our requirements on ASR, such as: + // + // * All types and kinds are correctly inferred and implicit casting + // nodes are correctly inserted in expressions + // * Types match for function / subroutine calls + // * All symbols in the Symbol Table correctly link back to it or the + // parent table. + // * All Fortran rules will be checked eventually, such as: + // * Initializer expression only uses intrinsic functions + // * Any function used in array dimension declaration is pure + // * Pure function only calls pure functions + // * ... + // + // This should not replace correct semantic checking in ast2asr. This is + // only meant as a tool for LFortran developers to check there are no bugs + // in LFortran code that constructs ASR and that some requirement was not + // accidentally broken. + // This should not be called in Release mode for performance reasons, but + // it should be called in our tests to ensure ast2asr, deserialization, all + // the ASR passes and any other code that constructs ASR does not have + // bugs. + // Any code that takes ASR as an argument can assume that it is verified. + // Such as the LLVM, C++ backend, or any ASR pass, or pickle. + + // The function will raise an exception if there is an error. Otherwise + // it will return true. It can be used in Debug mode only as: + // + // LFORTRAN_ASSERT(asr_verify(*asr)); + // + bool asr_verify(const ASR::TranslationUnit_t &unit, bool + check_external=true); + +} // namespace LFortran + +#endif // LFORTRAN_ASR_VERIFY_H diff --git a/src/lfortran/ast_to_src.cpp b/src/lfortran/ast_to_src.cpp index ec45be64a5..8ff8ec34f5 100644 --- a/src/lfortran/ast_to_src.cpp +++ b/src/lfortran/ast_to_src.cpp @@ -451,6 +451,48 @@ class ASTToSRCVisitor : public BaseVisitor s = r; } + void visit_Allocate(const Allocate_t &x) { + std::string r = indent; + r.append("allocate"); + r.append("("); + for (size_t i=0; ivisit_expr(*x.m_args[i].m_end); + r.append(s); + } else { + r += ":"; + } + if (i < x.n_args-1) r.append(", "); + } + if (x.n_keywords > 0) r.append(", "); + for (size_t i=0; ivisit_expr(*x.m_keywords[i].m_value); + r.append(s); + if (i < x.n_keywords-1) r.append(", "); + } + r.append(")\n"); + s = r; + } + + void visit_Deallocate(const Deallocate_t &x) { + std::string r = indent; + r.append("deallocate"); + r.append("("); + for (size_t i=0; ivisit_expr(*x.m_args[i].m_end); + r.append(s); + } else { + r += ":"; + } + if (i < x.n_args-1) r.append(", "); + } + r.append(")\n"); + s = r; + } + void visit_BuiltinCall(const BuiltinCall_t &x) { std::string r = indent; r += x.m_name; @@ -1015,6 +1057,15 @@ class ASTToSRCVisitor : public BaseVisitor } r.append(")"); } + if (x.n_dims > 0) { + r.append("("); + for (size_t i=0; ivisit_dimension(x.m_dims[i]); + r.append(s); + if (i < x.n_dims-1) r.append(", "); + } + r.append(")"); + } s = r; } diff --git a/src/lfortran/codegen/asr_to_cpp.cpp b/src/lfortran/codegen/asr_to_cpp.cpp index 8491d3f083..39df17ddc6 100644 --- a/src/lfortran/codegen/asr_to_cpp.cpp +++ b/src/lfortran/codegen/asr_to_cpp.cpp @@ -311,7 +311,7 @@ Kokkos::View from_std_vector(const std::vector &v) indentation_level -= 1; } - void visit_FuncCall(const ASR::FuncCall_t &x) { + void visit_FunctionCall(const ASR::FunctionCall_t &x) { ASR::Function_t *fn = ASR::down_cast(x.m_name); std::string fn_name = fn->m_name; if (sym_info[get_hash((ASR::asr_t*)x.m_name)].intrinsic_function) { diff --git a/src/lfortran/codegen/asr_to_llvm.cpp b/src/lfortran/codegen/asr_to_llvm.cpp index d71dc99983..6cff0b5cfe 100644 --- a/src/lfortran/codegen/asr_to_llvm.cpp +++ b/src/lfortran/codegen/asr_to_llvm.cpp @@ -102,7 +102,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor llvm::BasicBlock *current_loophead, *current_loopend; std::string mangle_prefix; bool prototype_only; - llvm::StructType *complex_type; + llvm::StructType *complex_type_4, *complex_type_8; llvm::PointerType *character_type; // Data Members for handling arrays @@ -260,8 +260,12 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor * _lfortran_complex_mul */ llvm::Value* lfortran_complex_bin_op(llvm::Value* left_arg, llvm::Value* right_arg, - std::string runtime_func_name) + std::string runtime_func_name, + llvm::Type* complex_type=nullptr) { + if( complex_type == nullptr ) { + complex_type = complex_type_4; + } llvm::Function *fn = module->getFunction(runtime_func_name); if (!fn) { llvm::FunctionType *function_type = llvm::FunctionType::get( @@ -276,6 +280,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor llvm::AllocaInst *pleft_arg = builder->CreateAlloca(complex_type, nullptr); + builder->CreateStore(left_arg, pleft_arg); llvm::AllocaInst *pright_arg = builder->CreateAlloca(complex_type, nullptr); @@ -319,7 +324,10 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor // This function is called as: // float complex_re(complex a) // And it extracts the real part of the complex number - llvm::Value *complex_re(llvm::Value *c) { + llvm::Value *complex_re(llvm::Value *c, llvm::Type* complex_type=nullptr) { + if( complex_type == nullptr ) { + complex_type = complex_type_4; + } llvm::AllocaInst *pc = builder->CreateAlloca(complex_type, nullptr); builder->CreateStore(c, pc); std::vector idx = { @@ -329,7 +337,10 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor return builder->CreateLoad(pim); } - llvm::Value *complex_im(llvm::Value *c) { + llvm::Value *complex_im(llvm::Value *c, llvm::Type* complex_type=nullptr) { + if( complex_type == nullptr ) { + complex_type = complex_type_4; + } llvm::AllocaInst *pc = builder->CreateAlloca(complex_type, nullptr); builder->CreateStore(c, pc); std::vector idx = { @@ -339,7 +350,11 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor return builder->CreateLoad(pim); } - llvm::Value *complex_from_floats(llvm::Value *re, llvm::Value *im) { + llvm::Value *complex_from_floats(llvm::Value *re, llvm::Value *im, + llvm::Type* complex_type=nullptr) { + if( complex_type == nullptr ) { + complex_type = complex_type_4; + } llvm::AllocaInst *pres = builder->CreateAlloca(complex_type, nullptr); std::vector idx1 = { llvm::ConstantInt::get(context, llvm::APInt(32, 0)), @@ -365,11 +380,21 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor * * void _lfortran_KEY(float x, float *result) */ - llvm::Value* lfortran_intrinsic(llvm::Function *fn, llvm::Value* pa) + llvm::Value* lfortran_intrinsic(llvm::Function *fn, llvm::Value* pa, int a_kind) { - llvm::AllocaInst *presult = builder->CreateAlloca( - llvm::Type::getFloatTy(context), - nullptr); + llvm::Type *presult_type; + switch(a_kind) + { + case 4: + presult_type = llvm::Type::getFloatTy(context); + break; + case 8: + presult_type = llvm::Type::getDoubleTy(context); + break; + default: + throw CodeGenError("Only 32 and 64 bits real kinds are supported."); + } + llvm::AllocaInst *presult = builder->CreateAlloca(presult_type, nullptr); llvm::Value *a = builder->CreateLoad(pa); std::vector args = {a, presult}; builder->CreateCall(fn, args); @@ -389,10 +414,14 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor // Define LLVM types that we might need // Complex type is represented as an identified struct in LLVM // %complex = type { float, float } - std::vector els = { + std::vector els_4 = { llvm::Type::getFloatTy(context), llvm::Type::getFloatTy(context)}; - complex_type = llvm::StructType::create(context, els, "complex"); + std::vector els_8 = { + llvm::Type::getDoubleTy(context), + llvm::Type::getDoubleTy(context)}; + complex_type_4 = llvm::StructType::create(context, els_4, "complex_4"); + complex_type_8 = llvm::StructType::create(context, els_8, "complex_8"); character_type = llvm::Type::getInt8PtrTy(context); // Process Variables first: @@ -414,9 +443,29 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } prototype_only = false; - // Then the rest: + // TODO: handle depencencies across modules and main program + + // Then do all the procedures for (auto &item : x.m_global_scope->scope) { - if (!is_a(*item.second)) { + if (is_a(*item.second) + || is_a(*item.second)) { + visit_symbol(*item.second); + } + } + + // Then do all the modules in the right order + std::vector build_order + = determine_module_dependencies(x); + for (auto &item : build_order) { + LFORTRAN_ASSERT(x.m_global_scope->scope.find(item) + != x.m_global_scope->scope.end()); + ASR::symbol_t *mod = x.m_global_scope->scope[item]; + visit_symbol(*mod); + } + + // Then the main program + for (auto &item : x.m_global_scope->scope) { + if (is_a(*item.second)) { visit_symbol(*item.second); } } @@ -497,8 +546,24 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor init_value = llvm::dyn_cast(tmp); } if (x.m_type->type == ASR::ttypeType::Integer) { + int a_kind = down_cast(x.m_type)->m_kind; + llvm::Type *type; + int init_value_bits; + switch(a_kind) + { + case 4: + type = llvm::Type::getInt32Ty(context); + init_value_bits = 32; + break; + case 8: + type = llvm::Type::getInt64Ty(context); + init_value_bits = 64; + break; + default: + throw CodeGenError("Only 32 and 64 bits integer kinds are supported."); + } llvm::Constant *ptr = module->getOrInsertGlobal(x.m_name, - llvm::Type::getInt32Ty(context)); + type); if (!external) { if (init_value) { module->getNamedGlobal(x.m_name)->setInitializer( @@ -506,21 +571,42 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } else { module->getNamedGlobal(x.m_name)->setInitializer( llvm::ConstantInt::get(context, - llvm::APInt(32, 0))); + llvm::APInt(init_value_bits, 0))); } } llvm_symtab[h] = ptr; } else if (x.m_type->type == ASR::ttypeType::Real) { - llvm::Constant *ptr = module->getOrInsertGlobal(x.m_name, - llvm::Type::getFloatTy(context)); + int a_kind = down_cast(x.m_type)->m_kind; + llvm::Type *type; + int init_value_bits; + switch(a_kind) + { + case 4: + type = llvm::Type::getFloatTy(context); + init_value_bits = 32; + break; + case 8: + type = llvm::Type::getDoubleTy(context); + init_value_bits = 64; + break; + default: + throw CodeGenError("Only 32 and 64 bits real kinds are supported."); + } + llvm::Constant *ptr = module->getOrInsertGlobal(x.m_name, type); if (!external) { if (init_value) { module->getNamedGlobal(x.m_name)->setInitializer( init_value); } else { - module->getNamedGlobal(x.m_name)->setInitializer( - llvm::ConstantFP::get(context, - llvm::APFloat((float)0))); + if( init_value_bits == 32 ) { + module->getNamedGlobal(x.m_name)->setInitializer( + llvm::ConstantFP::get(context, + llvm::APFloat((float)0))); + } else if( init_value_bits == 64 ) { + module->getNamedGlobal(x.m_name)->setInitializer( + llvm::ConstantFP::get(context, + llvm::APFloat((double)0))); + } } } llvm_symtab[h] = ptr; @@ -627,10 +713,22 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } break; } - case (ASR::ttypeType::Complex) : - // TODO: Assuming single precision - type = complex_type; + case (ASR::ttypeType::Complex) : { + int a_kind = down_cast(v->m_type)->m_kind; + switch( a_kind ) + { + case 4: + type = complex_type_4; + break; + case 8: + type = complex_type_8; + break; + default: + throw SemanticError("Only 32 and 64 bits complex kinds are supported.", + x.base.base.loc); + } break; + } case (ASR::ttypeType::Character) : type = character_type; break; @@ -711,13 +809,39 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor ASR::Variable_t *arg = EXPR2VAR(x.m_args[i]); LFORTRAN_ASSERT(is_arg_dummy(arg->m_intent)); // We pass all arguments as pointers for now + llvm::Type *type; switch (arg->m_type->type) { - case (ASR::ttypeType::Integer) : - args.push_back(llvm::Type::getInt32PtrTy(context)); + case (ASR::ttypeType::Integer) : { + int a_kind = down_cast(arg->m_type)->m_kind; + switch( a_kind ) + { + case 4: + type = llvm::Type::getInt32PtrTy(context); + break; + case 8: + type = llvm::Type::getInt64PtrTy(context); + break; + default: + throw SemanticError("Only 32 and 64 bits real kinds are supported.", + x.base.base.loc); + } break; - case (ASR::ttypeType::Real) : - args.push_back(llvm::Type::getFloatPtrTy(context)); + } + case (ASR::ttypeType::Real) : { + int a_kind = down_cast(arg->m_type)->m_kind; + switch(a_kind) + { + case 4: + type = llvm::Type::getFloatPtrTy(context); + break; + case 8: + type = llvm::Type::getDoublePtrTy(context); + break; + default: + throw CodeGenError("Only 32 and 64 bits real kinds are supported."); + } break; + } case (ASR::ttypeType::Complex) : throw CodeGenError("Complex argument type not implemented yet in conversion"); break; @@ -725,7 +849,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor throw CodeGenError("Character argument type not implemented yet in conversion"); break; case (ASR::ttypeType::Logical) : - args.push_back(llvm::Type::getInt1PtrTy(context)); + type = llvm::Type::getInt1PtrTy(context); break; case (ASR::ttypeType::Derived) : throw CodeGenError("Derived type argument not implemented yet in conversion"); @@ -733,6 +857,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor default : LFORTRAN_ASSERT(false); } + args.push_back(type); } return args; } @@ -773,15 +898,45 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor */ F = llvm_symtab_fn[h]; } else { - ASR::ttypeType return_var_type = EXPR2VAR(x.m_return_var)->m_type->type; + ASR::ttype_t *return_var_type0 = EXPR2VAR(x.m_return_var)->m_type; + ASR::ttypeType return_var_type = return_var_type0->type; llvm::Type *return_type; switch (return_var_type) { - case (ASR::ttypeType::Integer) : - return_type = llvm::Type::getInt32Ty(context); + case (ASR::ttypeType::Integer) : { + int a_kind = down_cast(return_var_type0)->m_kind; + switch( a_kind ) { + case 4 : { + return_type = llvm::Type::getInt32Ty(context); + break; + } + case 8 : { + return_type = llvm::Type::getInt64Ty(context); + break; + } + default : { + throw CodeGenError("Only integer kinds 4 and 8 are implemented"); + break; + } + } break; - case (ASR::ttypeType::Real) : - return_type = llvm::Type::getFloatTy(context); + } + case (ASR::ttypeType::Real) : { + int a_kind = down_cast(return_var_type0)->m_kind; + switch( a_kind ) { + case 4 : { + return_type = llvm::Type::getFloatTy(context); + break; + } + case 8 : { + return_type = llvm::Type::getDoubleTy(context); + break; + } + default : { + throw CodeGenError("Only real kinds 4 and 8 are implemented"); + } + } break; + } case (ASR::ttypeType::Complex) : throw CodeGenError("Complex return type not implemented yet"); break; @@ -1142,24 +1297,46 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor break; }; case ASR::binopType::Pow: { + llvm::Type *type; + int a_kind; + a_kind = down_cast(x.m_type)->m_kind; + switch(a_kind) + { + case 4: + type = llvm::Type::getFloatTy(context); + break; + case 8: + type = llvm::Type::getDoubleTy(context); + break; + default: + throw CodeGenError("Only 32 and 64 bits real kinds are supported."); + } llvm::Value *fleft = builder->CreateSIToFP(left_val, - llvm::Type::getFloatTy(context)); + type); llvm::Value *fright = builder->CreateSIToFP(right_val, - llvm::Type::getFloatTy(context)); - - llvm::Function *fn_pow = module->getFunction("llvm.pow.f32"); + type); + std::string func_name = a_kind == 4 ? "llvm.pow.f32" : "llvm.pow.f64"; + llvm::Function *fn_pow = module->getFunction(func_name); if (!fn_pow) { llvm::FunctionType *function_type = llvm::FunctionType::get( - llvm::Type::getFloatTy(context), { - llvm::Type::getFloatTy(context), - llvm::Type::getFloatTy(context) - }, false); + type, { type, type}, false); fn_pow = llvm::Function::Create(function_type, - llvm::Function::ExternalLinkage, "llvm.pow.f32", + llvm::Function::ExternalLinkage, func_name, module.get()); } tmp = builder->CreateCall(fn_pow, {fleft, fright}); - tmp = builder->CreateFPToSI(tmp, llvm::Type::getInt32Ty(context)); + switch(a_kind) + { + case 4: + type = llvm::Type::getInt32Ty(context); + break; + case 8: + type = llvm::Type::getInt64Ty(context); + break; + default: + throw CodeGenError("Only 32 and 64 bits integer kinds are supported."); + } + tmp = builder->CreateFPToSI(tmp, type); break; }; } @@ -1183,15 +1360,27 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor break; }; case ASR::binopType::Pow: { - llvm::Function *fn_pow = module->getFunction("llvm.pow.f32"); + llvm::Type *type; + int a_kind; + a_kind = down_cast(x.m_type)->m_kind; + switch(a_kind) + { + case 4: + type = llvm::Type::getFloatTy(context); + break; + case 8: + type = llvm::Type::getDoubleTy(context); + break; + default: + throw CodeGenError("Only 32 and 64 bits real kinds are supported."); + } + std::string func_name = a_kind == 4 ? "llvm.pow.f32" : "llvm.pow.f64"; + llvm::Function *fn_pow = module->getFunction(func_name); if (!fn_pow) { llvm::FunctionType *function_type = llvm::FunctionType::get( - llvm::Type::getFloatTy(context), { - llvm::Type::getFloatTy(context), - llvm::Type::getFloatTy(context) - }, false); + type, { type, type }, false); fn_pow = llvm::Function::Create(function_type, - llvm::Function::ExternalLinkage, "llvm.pow.f32", + llvm::Function::ExternalLinkage, func_name, module.get()); } tmp = builder->CreateCall(fn_pow, {left_val, right_val}); @@ -1200,25 +1389,39 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } } else if (x.m_type->type == ASR::ttypeType::Complex || x.m_type->type == ASR::ttypeType::ComplexPointer) { + llvm::Type *type; + int a_kind; + a_kind = down_cast(x.m_type)->m_kind; + switch(a_kind) + { + case 4: + type = complex_type_4; + break; + case 8: + type = complex_type_8; + break; + default: + throw CodeGenError("Only 32 and 64 bits complex kinds are supported."); + } switch (x.m_op) { case ASR::binopType::Add: { - tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_add"); + tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_add", type); break; }; case ASR::binopType::Sub: { - tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_sub"); + tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_sub", type); break; }; case ASR::binopType::Mul: { - tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_mul"); + tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_mul", type); break; }; case ASR::binopType::Div: { - tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_div"); + tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_div", type); break; }; case ASR::binopType::Pow: { - tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_pow"); + tmp = lfortran_complex_bin_op(left_val, right_val, "_lfortran_complex_pow", type); break; }; } @@ -1313,10 +1516,38 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor ASR::down_cast(x.m_re)->m_r); double im = std::atof( ASR::down_cast(x.m_im)->m_r); - // TODO: assuming single precision - llvm::Value *re2 = llvm::ConstantFP::get(context, llvm::APFloat((float)re)); - llvm::Value *im2 = llvm::ConstantFP::get(context, llvm::APFloat((float)im)); - tmp = complex_from_floats(re2, im2); + int a_kind = extract_kind_from_ttype_t(x.m_type); + llvm::Value *re2, *im2; + llvm::Type *type; + switch( a_kind ) { + case 4: { + re2 = llvm::ConstantFP::get(context, llvm::APFloat((float)re)); + type = complex_type_4; + break; + } + case 8: { + re2 = llvm::ConstantFP::get(context, llvm::APFloat(re)); + type = complex_type_8; + break; + } + default: { + break; + } + } + switch( a_kind ) { + case 4: { + im2 = llvm::ConstantFP::get(context, llvm::APFloat((float)im)); + break; + } + case 8: { + im2 = llvm::ConstantFP::get(context, llvm::APFloat(im)); + break; + } + default: { + break; + } + } + tmp = complex_from_floats(re2, im2, type); } void visit_ConstantLogical(const ASR::ConstantLogical_t &x) { @@ -1393,6 +1624,12 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor case ASR::ttypeType::IntegerPointer : { return ((ASR::IntegerPointer_t*)(&(curr_type->base)))->m_kind; } + case ASR::ttypeType::Complex: { + return ((ASR::Complex_t*)(&(curr_type->base)))->m_kind; + } + case ASR::ttypeType::ComplexPointer: { + return ((ASR::ComplexPointer_t*)(&(curr_type->base)))->m_kind; + } default : { return -1; } @@ -1410,6 +1647,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } case ASR::exprType::BinOp : { return ((ASR::BinOp_t*)base)->m_type; + } + case ASR::exprType::ConstantComplex: { + return ((ASR::ConstantComplex_t*)base)->m_type; } default : { return nullptr; @@ -1447,20 +1687,66 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor break; } case (ASR::cast_kindType::RealToInteger) : { - tmp = builder->CreateFPToSI(tmp, llvm::Type::getInt32Ty(context)); + llvm::Type *target_type; + int a_kind = extract_kind_from_ttype_t(x.m_type); + switch(a_kind) + { + case 4: + target_type = llvm::Type::getInt32Ty(context); + break; + case 8: + target_type = llvm::Type::getInt64Ty(context); + break; + default: + throw CodeGenError("Only 32 and 64 bits integer kinds are supported."); + } + tmp = builder->CreateFPToSI(tmp, target_type); break; } case (ASR::cast_kindType::RealToComplex) : { - llvm::Value *zero = llvm::ConstantFP::get(context, - llvm::APFloat((float)0.0)); - tmp = complex_from_floats(tmp, zero); + llvm::Type *target_type; + llvm::Value *zero; + int a_kind = extract_kind_from_ttype_t(x.m_type); + switch(a_kind) + { + case 4: + target_type = complex_type_4; + tmp = builder->CreateFPTrunc(tmp, llvm::Type::getFloatTy(context)); + zero = llvm::ConstantFP::get(context, llvm::APFloat((float)0.0)); + break; + case 8: + target_type = complex_type_8; + tmp = builder->CreateFPExt(tmp, llvm::Type::getDoubleTy(context)); + zero = llvm::ConstantFP::get(context, llvm::APFloat(0.0)); + break; + default: + throw CodeGenError("Only 32 and 64 bits real kinds are supported."); + } + tmp = complex_from_floats(tmp, zero, target_type); break; } case (ASR::cast_kindType::IntegerToComplex) : { - tmp = builder->CreateSIToFP(tmp, llvm::Type::getFloatTy(context)); - llvm::Value *zero = llvm::ConstantFP::get(context, - llvm::APFloat((float)0.0)); - tmp = complex_from_floats(tmp, zero); + int a_kind = extract_kind_from_ttype_t(x.m_type); + llvm::Type *target_type; + llvm::Type *complex_type; + llvm::Value *zero; + switch(a_kind) + { + case 4: + target_type = llvm::Type::getFloatTy(context); + complex_type = complex_type_4; + zero = llvm::ConstantFP::get(context, llvm::APFloat((float)0.0)); + break; + case 8: + target_type = llvm::Type::getDoubleTy(context); + complex_type = complex_type_8; + zero = llvm::ConstantFP::get(context, llvm::APFloat(0.0)); + break; + default: + throw CodeGenError("Only 32 and 64 bits real kinds are supported."); + } + tmp = builder->CreateSIToFP(tmp, target_type); + tmp = complex_from_floats(tmp, zero, complex_type); break; } case (ASR::cast_kindType::IntegerToLogical) : { @@ -1501,6 +1787,34 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } break; } + case (ASR::cast_kindType::ComplexToComplex) : { + llvm::Type *target_type; + int arg_kind = -1, dest_kind = -1; + extract_kinds(x, arg_kind, dest_kind); + llvm::Value *re, *im; + if( arg_kind > 0 && dest_kind > 0 ) + { + if( arg_kind == 4 && dest_kind == 8 ) { + target_type = complex_type_8; + re = complex_re(tmp, complex_type_4); + re = builder->CreateFPExt(re, llvm::Type::getDoubleTy(context)); + im = complex_im(tmp, complex_type_4); + im = builder->CreateFPExt(im, llvm::Type::getDoubleTy(context)); + } else if( arg_kind == 8 && dest_kind == 4 ) { + target_type = complex_type_4; + re = complex_re(tmp, complex_type_8); + re = builder->CreateFPTrunc(re, llvm::Type::getFloatTy(context)); + im = complex_im(tmp, complex_type_8); + im = builder->CreateFPTrunc(im, llvm::Type::getFloatTy(context)); + } else { + std::string msg = "Conversion from " + std::to_string(arg_kind) + + " to " + std::to_string(dest_kind) + " not implemented yet."; + throw CodeGenError(msg); + } + } + tmp = complex_from_floats(re, im, target_type); + break; + } default : throw CodeGenError("Cast kind not implemented"); } } @@ -1566,12 +1880,34 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor fmt.push_back("%s"); args.push_back(tmp); } else if (t->type == ASR::ttypeType::Complex) { - fmt.push_back("(%f,%f)"); - llvm::Value *d = builder->CreateFPExt(complex_re(tmp), - llvm::Type::getDoubleTy(context)); + int a_kind = ((ASR::Complex_t*)(&(t->base)))->m_kind; + llvm::Type *type, *complex_type; + switch( a_kind ) { + case 4 : { + // Cast float to double as a workaround for the fact that + // vprintf() seems to cast to double even for %f, which + // causes it to print 0.000000. + fmt.push_back("(%f,%f)"); + type = llvm::Type::getDoubleTy(context); + complex_type = complex_type_4; + break; + } + case 8 : { + fmt.push_back("(%lf,%lf)"); + type = llvm::Type::getDoubleTy(context); + complex_type = complex_type_8; + break; + } + default: { + throw SemanticError(R"""(Printing support is available only + for 32, and 64 bit complex kinds.)""", + x.base.base.loc); + } + } + llvm::Value *d; + d = builder->CreateFPExt(complex_re(tmp, complex_type), type); args.push_back(d); - d = builder->CreateFPExt(complex_im(tmp), - llvm::Type::getDoubleTy(context)); + d = builder->CreateFPExt(complex_im(tmp, complex_type), type); args.push_back(d); } else { throw LFortranException("Type not implemented"); @@ -1620,16 +1956,53 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor this->visit_expr(*x.m_args[i]); llvm::Value *value=tmp; llvm::Type *target_type; - switch (expr_type(x.m_args[i])->type) { - case (ASR::ttypeType::Integer) : - target_type = llvm::Type::getInt32Ty(context); + ASR::ttype_t* arg_type = expr_type(x.m_args[i]); + switch (arg_type->type) { + case (ASR::ttypeType::Integer) : { + int a_kind = down_cast(arg_type)->m_kind; + switch(a_kind) + { + case 4: + target_type = llvm::Type::getInt32Ty(context); + break; + case 8: + target_type = llvm::Type::getInt64Ty(context); + break; + default: + throw CodeGenError("Only 32 and 64 bits integer kinds are supported."); + } break; - case (ASR::ttypeType::Real) : - target_type = llvm::Type::getFloatTy(context); + } + case (ASR::ttypeType::Real) : { + int a_kind = down_cast(arg_type)->m_kind; + switch(a_kind) + { + case 4: + target_type = llvm::Type::getFloatTy(context); + break; + case 8: + target_type = llvm::Type::getDoubleTy(context); + break; + default: + throw CodeGenError("Only 32 and 64 bits real kinds are supported."); + } break; - case (ASR::ttypeType::Complex) : - target_type = complex_type; + } + case (ASR::ttypeType::Complex) : { + int a_kind = down_cast(arg_type)->m_kind; + switch(a_kind) + { + case 4: + target_type = complex_type_4; + break; + case 8: + target_type = complex_type_8; + break; + default: + throw CodeGenError("Only 32 and 64 bits complex kinds are supported."); + } break; + } case (ASR::ttypeType::Character) : throw CodeGenError("Character argument type not implemented yet in conversion"); break; @@ -1653,7 +2026,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } void visit_SubroutineCall(const ASR::SubroutineCall_t &x) { - ASR::Subroutine_t *s = ASR::down_cast(x.m_name); + ASR::Subroutine_t *s = ASR::down_cast( + symbol_get_past_external(x.m_name)); uint32_t h; if (s->m_abi == ASR::abiType::LFortranModule) { throw CodeGenError("Subroutine LFortran interfaces not implemented yet"); @@ -1673,8 +2047,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor builder->CreateCall(fn, args); } - void visit_FuncCall(const ASR::FuncCall_t &x) { - ASR::Function_t *s = ASR::down_cast(x.m_name); + void visit_FunctionCall(const ASR::FunctionCall_t &x) { + ASR::Function_t *s = ASR::down_cast(symbol_get_past_external(x.m_name)); uint32_t h; if (s->m_abi == ASR::abiType::Source) { h = get_hash((ASR::asr_t*)s); @@ -1683,8 +2057,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } else if (s->m_abi == ASR::abiType::Interactive) { h = get_hash((ASR::asr_t*)s); } else if (s->m_abi == ASR::abiType::Intrinsic) { + int a_kind = extract_kind_from_ttype_t(x.m_type); if (all_intrinsics.empty()) { - populate_intrinsics(); + populate_intrinsics(x.m_type); } // We use an unordered map to get the O(n) operation time std::unordered_map::const_iterator @@ -1694,7 +2069,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } else { std::vector args = convert_call_args(x); LFORTRAN_ASSERT(args.size() == 1); - tmp = lfortran_intrinsic(find_intrinsic->second, args[0]); + tmp = lfortran_intrinsic(find_intrinsic->second, args[0], a_kind); return; } h = get_hash((ASR::asr_t *)s); @@ -1711,7 +2086,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } //!< Meant to be called only once - void populate_intrinsics() { + void populate_intrinsics(ASR::ttype_t* _type) { std::vector supported = { "sin", "cos", "tan", "sinh", "cosh", "tanh", "asin", "acos", "atan", "asinh", "acosh", "atanh"}; @@ -1720,10 +2095,27 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor auto fname = "_lfortran_" + sv; llvm::Function *fn = module->getFunction(fname); if (!fn) { + int a_kind = extract_kind_from_ttype_t(_type); + llvm::Type *func_type, *ptr_type; + switch( a_kind ) { + case 4: { + func_type = llvm::Type::getFloatTy(context); + ptr_type = llvm::Type::getFloatPtrTy(context); + break; + } + case 8: { + func_type = llvm::Type::getDoubleTy(context); + ptr_type = llvm::Type::getDoublePtrTy(context); + break; + } + default: { + break; + } + } llvm::FunctionType *function_type = llvm::FunctionType::get(llvm::Type::getVoidTy(context), - {llvm::Type::getFloatTy(context), - llvm::Type::getFloatPtrTy(context)}, + {func_type, + ptr_type}, false); fn = llvm::Function::Create( function_type, llvm::Function::ExternalLinkage, fname, *module); diff --git a/src/lfortran/codegen/asr_to_x86.cpp b/src/lfortran/codegen/asr_to_x86.cpp index 4bd9046b8c..92798dc968 100644 --- a/src/lfortran/codegen/asr_to_x86.cpp +++ b/src/lfortran/codegen/asr_to_x86.cpp @@ -574,7 +574,7 @@ class ASRToX86Visitor : public ASR::BaseVisitor m_a.asm_add_r32_imm8(LFortran::X86Reg::esp, arg_offset); } - void visit_FuncCall(const ASR::FuncCall_t &x) { + void visit_FunctionCall(const ASR::FunctionCall_t &x) { ASR::Function_t *s = ASR::down_cast(x.m_name); uint32_t h = get_hash((ASR::asr_t*)s); diff --git a/src/lfortran/mod_to_asr.cpp b/src/lfortran/mod_to_asr.cpp index 50cfc49a75..6d354cd4d5 100644 --- a/src/lfortran/mod_to_asr.cpp +++ b/src/lfortran/mod_to_asr.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -333,7 +334,9 @@ ASR::TranslationUnit_t* parse_gfortran_mod_file(Allocator &al, const std::string Location loc; asr = ASR::make_TranslationUnit_t(al, loc, parent_scope, nullptr, 0); - return down_cast2(asr); + ASR::TranslationUnit_t *tu = down_cast2(asr); + LFORTRAN_ASSERT(asr_verify(*tu)); + return tu; //std::cout << format_item(mod); diff --git a/src/lfortran/modfile.cpp b/src/lfortran/modfile.cpp new file mode 100644 index 0000000000..d2939bee4b --- /dev/null +++ b/src/lfortran/modfile.cpp @@ -0,0 +1,146 @@ +#include + +#include +#include +#include +#include + + +namespace LFortran { + + +class BinaryWriter +{ +private: + std::string s; +public: + std::string get_str() { + return s; + } + + void write_int8(uint8_t i) { + char c=i; + s.append(std::string(&c, 1)); + } + + void write_int64(uint64_t i) { + s.append(uint64_to_string(i)); + } + + void write_bool(bool b) { + if (b) { + write_int8(1); + } else { + write_int8(0); + } + } + + void write_string(const std::string &t) { + write_int64(t.size()); + s.append(t); + } +}; + +class BinaryReader +{ +private: + std::string s; + size_t pos; +public: + BinaryReader(const std::string &s) : s{s}, pos{0} {} + + uint8_t read_int8() { + if (pos+1 > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + uint8_t n = s[pos]; + pos += 1; + return n; + } + + uint64_t read_int64() { + if (pos+4 > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + uint64_t n = string_to_uint64(&s[pos]); + pos += 4; + return n; + } + + bool read_bool() { + uint8_t b = read_int8(); + return (b == 1); + } + + std::string read_string() { + size_t n = read_int64(); + if (pos+n > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + std::string r = std::string(&s[pos], n); + pos += n; + return r; + } +}; + +const std::string lfortran_modfile_type_string = "LFortran Modfile"; + +// The save_modfile() and load_modfile() must stay consistent. What is saved +// must be loaded in exactly the same order. + +/* + Saves the module into a binary stream. + + That stream can be saved to a mod file by the caller. + The sections in the file/stream are saved using write_string(), so they + can be efficiently read by the loader and ignored if needed. + + Comments below show some possible future improvements to the mod format. +*/ +std::string save_modfile(const ASR::TranslationUnit_t &m) { + LFORTRAN_ASSERT(m.m_global_scope->scope.size()== 1); + for (auto &a : m.m_global_scope->scope) { + LFORTRAN_ASSERT(ASR::is_a(*a.second)); + } + BinaryWriter b; + // Header + b.write_string(lfortran_modfile_type_string); + b.write_string(LFORTRAN_VERSION); + + // AST section: Original module source code: + // Currently empty. + // Note: in the future we can save here: + // * A path to the original source code + // * Hash of the orig source code + // * AST binary export of it (this AST only changes if the hash changes) + + // ASR section: + + // Export ASR: + // Currently empty. + + // Full ASR: + b.write_string(serialize(m)); + + return b.get_str(); +} + +ASR::TranslationUnit_t* load_modfile(Allocator &al, const std::string &s, + bool load_symtab_id, SymbolTable &symtab) { + BinaryReader b(s); + std::string file_type = b.read_string(); + if (file_type != lfortran_modfile_type_string) { + throw LFortranException("LFortran Modfile format not recognized"); + } + std::string version = b.read_string(); + if (version != LFORTRAN_VERSION) { + throw LFortranException("Incompatible format: LFortran Modfile was generated using version '" + version + "', but current LFortran version is '" + LFORTRAN_VERSION + "'"); + } + std::string asr_binary = b.read_string(); + ASR::asr_t *asr = deserialize_asr(al, asr_binary, load_symtab_id, symtab); + + ASR::TranslationUnit_t *tu = ASR::down_cast2(asr); + return tu; +} + +} // namespace LFortran diff --git a/src/lfortran/modfile.h b/src/lfortran/modfile.h new file mode 100644 index 0000000000..71189f3878 --- /dev/null +++ b/src/lfortran/modfile.h @@ -0,0 +1,17 @@ +#ifndef LFORTRAN_MODFILE_H +#define LFORTRAN_MODFILE_H + +#include + +namespace LFortran { + + // Save a module to a modfile + std::string save_modfile(const ASR::TranslationUnit_t &m); + + // Load a module from a modfile + ASR::TranslationUnit_t* load_modfile(Allocator &al, const std::string &s, + bool load_symtab_id, SymbolTable &symtab); + +} + +#endif // LFORTRAN_MODFILE_H diff --git a/src/lfortran/parser/parser.yy b/src/lfortran/parser/parser.yy index a9f6fe88e4..86f35c2ae2 100644 --- a/src/lfortran/parser/parser.yy +++ b/src/lfortran/parser/parser.yy @@ -992,11 +992,11 @@ block_statement allocate_statement : KW_ALLOCATE "(" fnarray_arg_list_opt ")" { - $$ = PRINT0(@$); } + $$ = ALLOCATE_STMT($3, @$); } deallocate_statement : KW_DEALLOCATE "(" fnarray_arg_list_opt ")" { - $$ = PRINT0(@$); } + $$ = DEALLOCATE_STMT($3, @$); } nullify_statement : KW_NULLIFY "(" fnarray_arg_list_opt ")" { @@ -1301,7 +1301,7 @@ return_statement ; cycle_statement - : KW_CYCLE { $$ = CYCLE(@$); } + : KW_CYCLE id_opt { $$ = CYCLE(@$); } ; continue_statement @@ -1354,6 +1354,8 @@ expr | "(" expr ")" { $$ = $2; } | "(" expr "," expr ")" { $$ = COMPLEX($2, $4, @$); } | "(" expr "," id "=" expr "," expr ")" { $$ = $2; } // TODO: return a generator expression + | "(" expr "," expr "," id "=" expr "," expr ")" { $$ = $2; } // TODO: return a generator expression + | "(" expr "," expr "," expr_list "," id "=" expr "," expr ")" { $$ = $2; } // TODO: return a generator expression // ### level-1 diff --git a/src/lfortran/parser/semantics.h b/src/lfortran/parser/semantics.h index 3470501f68..ccad4f63bd 100644 --- a/src/lfortran/parser/semantics.h +++ b/src/lfortran/parser/semantics.h @@ -151,6 +151,29 @@ static inline LFortran::AST::kind_item_t *make_kind_item_t(Allocator &al, #define KIND_ARG2C(id, l) make_kind_item_t(p.m_a, l, name2char(id), nullptr, \ LFortran::AST::kind_item_typeType::Colon) +// This function ensures that all members of decl_t are set +// These functions should eventually be generated by asdl_cpp.py for +// every product type such as decl_t to ensure all members are present +void set_decl_t(decl_t &d, + char* m_sym, + char* m_sym_type, + char* m_derived_type_name, + LFortran::AST::kind_item_t* m_kind, size_t n_kind, + dimension_t* m_dims, size_t n_dims, + attribute_t** m_attrs, size_t n_attrs, + expr_t* m_initializer) { + d.m_sym = m_sym; + d.m_sym_type = m_sym_type; + d.m_derived_type_name = m_derived_type_name; + d.m_kind = m_kind; + d.n_kind = n_kind; + d.m_dims = m_dims; + d.n_dims = n_dims; + d.m_attrs = m_attrs; + d.n_attrs = n_attrs; + d.m_initializer = m_initializer; +} + static inline decl_t* DECL(Allocator &al, const LFortran::Vec &x, char *type, LFortran::Vec kind, char *derived_type_name, @@ -193,14 +216,12 @@ static inline decl_t* DECL2b(Allocator &al, const ast_t *attr) decl_t *s = al.allocate(1); attribute_t **a = al.allocate(1); a[0] = ATTR(attr); - - s[0].m_sym = nullptr; - s[0].m_sym_type = nullptr; - s[0].m_dims = nullptr; - s[0].n_dims = 0; - s[0].m_attrs = a; - s[0].n_attrs = 1; - s[0].m_initializer = nullptr; + set_decl_t(s[0], nullptr, nullptr, nullptr, + nullptr, 0, + nullptr, 0, + a, 1, + nullptr + ); return s; } @@ -208,13 +229,12 @@ static inline decl_t* DECL2c(Allocator &al, Location &l) { decl_t *s = al.allocate(1); s[0].loc = l; - s[0].m_sym = nullptr; - s[0].m_sym_type = nullptr; - s[0].m_dims = nullptr; - s[0].n_dims = 0; - s[0].m_attrs = nullptr; - s[0].n_attrs = 0; - s[0].m_initializer = nullptr; + set_decl_t(s[0], nullptr, nullptr, nullptr, + nullptr, 0, + nullptr, 0, + nullptr, 0, + nullptr + ); return s; } @@ -222,8 +242,6 @@ static inline decl_t* DECL3(Allocator &al, ast_t* n, const LFortran::Vec *d, expr_t *e) { decl_t *s = al.allocate(); - s->m_sym = name2char(n); - s->m_sym_type = nullptr; if (d) { s->n_dims = d->size(); s->m_dims = d->p; @@ -231,9 +249,12 @@ static inline decl_t* DECL3(Allocator &al, ast_t* n, s->n_dims = 0; s->m_dims = nullptr; } - s->n_attrs = 0; - s->m_attrs = nullptr; - s->m_initializer = e; + set_decl_t(s[0], name2char(n), nullptr, nullptr, + nullptr, 0, + s[0].m_dims, s[0].n_dims, + nullptr, 0, + e + ); return s; } @@ -459,6 +480,43 @@ ast_t* SUBROUTINE_CALL0(Allocator &al, const ast_t *id, name2char(name), \ nullptr, 0, nullptr, 0) +LFortran::Vec FNARGS(Allocator &al, + const LFortran::Vec &args) { + LFortran::Vec v; + v.reserve(al, args.size()); + LFortran::Vec v2; + v2.reserve(al, args.size()); + for (auto &item : args) { + if (item.keyword) { + v2.push_back(al, item.kw); + LFORTRAN_ASSERT(false); + } else { + v.push_back(al, item.arg); + } + } + return v; +} +ast_t* ALLOCATE_STMT0(Allocator &al, + const LFortran::Vec &args, Location &l) { + LFortran::Vec v; + v.reserve(al, args.size()); + LFortran::Vec v2; + v2.reserve(al, args.size()); + for (auto &item : args) { + if (item.keyword) { + v2.push_back(al, item.kw); + } else { + v.push_back(al, item.arg); + } + } + return make_Allocate_t(al, l, + /*expr_t** a_args*/ v.p, /*size_t n_args*/ v.size(), + /*keyword_t* a_keywords*/ v2.p, /*size_t n_keywords*/ v2.size()); +} +#define ALLOCATE_STMT(args, l) ALLOCATE_STMT0(p.m_a, args, l) +#define DEALLOCATE_STMT(args, l) LFortran::AST::make_Deallocate_t(p.m_a, l, \ + FNARGS(p.m_a, args).p, args.size()) + #define PRINT0(l) make_Print_t(p.m_a, l, nullptr, nullptr, 0) #define PRINT(args, l) make_Print_t(p.m_a, l, nullptr, EXPRS(args), args.size()) #define PRINTF0(fmt, l) make_Print_t(p.m_a, l, fmt.c_str(p.m_a), nullptr, 0) @@ -845,7 +903,7 @@ ast_t* FUNCCALLORARRAY0(Allocator &al, const ast_t *id, #define MODULE(name, use, decl, contains, l) make_Module_t(p.m_a, l, \ name2char(name), \ - /*unit_decl1_t** a_use*/ nullptr, /*size_t n_use*/ 0, \ + /*unit_decl1_t** a_use*/ USES(use), /*size_t n_use*/ use.size(), \ /*unit_decl2_t** a_decl*/ DECLS(decl), /*size_t n_decl*/ decl.size(), \ /*program_unit_t** a_contains*/ CONTAINS(contains), /*size_t n_contains*/ contains.size()) #define PRIVATE0(l) make_Private_t(p.m_a, l, \ diff --git a/src/lfortran/pass/do_loops.cpp b/src/lfortran/pass/do_loops.cpp index f8f9991137..6f044c20fa 100644 --- a/src/lfortran/pass/do_loops.cpp +++ b/src/lfortran/pass/do_loops.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -107,12 +108,6 @@ class DoLoopVisitor : public ASR::BaseWalkVisitor } - void visit_TranslationUnit(const ASR::TranslationUnit_t &x) { - for (auto &a : x.m_global_scope->scope) { - this->visit_symbol(*a.second); - } - } - void transform_stmts(ASR::stmt_t **&m_body, size_t &n_body) { Vec body; body.reserve(al, n_body); @@ -188,6 +183,7 @@ void pass_replace_do_loops(Allocator &al, ASR::TranslationUnit_t &unit) { // to transform doubly nested loops: v.visit_TranslationUnit(unit); v.visit_TranslationUnit(unit); + LFORTRAN_ASSERT(asr_verify(unit)); } diff --git a/src/lfortran/pass/global_stmts.cpp b/src/lfortran/pass/global_stmts.cpp index 46abafec28..03a9c1900c 100644 --- a/src/lfortran/pass/global_stmts.cpp +++ b/src/lfortran/pass/global_stmts.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -40,7 +41,10 @@ void pass_wrap_global_stmts_into_function(Allocator &al, if (expr_type(value)->type == ASR::ttypeType::Integer) { s.from_str(al, fn_name_s + std::to_string(idx)); var_name = s.c_str(al); - type = TYPE(ASR::make_Integer_t(al, loc, 4, nullptr, 0)); + + int a_kind = down_cast(expr_type(value))->m_kind; + + type = TYPE(ASR::make_Integer_t(al, loc, a_kind, nullptr, 0)); return_var = ASR::make_Variable_t(al, loc, fn_scope, var_name, intent_local, nullptr, ASR::storage_typeType::Default, type, @@ -123,6 +127,7 @@ void pass_wrap_global_stmts_into_function(Allocator &al, } unit.m_items = nullptr; unit.n_items = 0; + LFORTRAN_ASSERT(asr_verify(unit)); } } diff --git a/src/lfortran/pass/select_case.cpp b/src/lfortran/pass/select_case.cpp index 831fe877a1..5d1cdd3d83 100644 --- a/src/lfortran/pass/select_case.cpp +++ b/src/lfortran/pass/select_case.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -155,12 +156,6 @@ class SelectCaseVisitor : public ASR::BaseWalkVisitor } - void visit_TranslationUnit(const ASR::TranslationUnit_t &x) { - for (auto &a : x.m_global_scope->scope) { - this->visit_symbol(*a.second); - } - } - void transform_stmts(ASR::stmt_t **&m_body, size_t &n_body) { Vec body; body.reserve(al, n_body); @@ -236,6 +231,7 @@ void pass_replace_select_case(Allocator &al, ASR::TranslationUnit_t &unit) { // to transform doubly nested loops: v.visit_TranslationUnit(unit); v.visit_TranslationUnit(unit); + LFORTRAN_ASSERT(asr_verify(unit)); } diff --git a/src/lfortran/semantics/ast_to_asr.cpp b/src/lfortran/semantics/ast_to_asr.cpp index 8368be600f..44cb0cb91a 100644 --- a/src/lfortran/semantics/ast_to_asr.cpp +++ b/src/lfortran/semantics/ast_to_asr.cpp @@ -1,12 +1,16 @@ #include #include +#include #include #include #include #include #include +#include #include +#include +#include #include #include #include @@ -98,6 +102,35 @@ namespace LFortran { return HelperMethods::is_same_type_pointer(x, y); } + + inline static int extract_kind_from_ttype_t(const ASR::ttype_t* curr_type) { + if( curr_type == nullptr ) { + return -1; + } + switch (curr_type->type) { + case ASR::ttypeType::Real : { + return ((ASR::Real_t*)(&(curr_type->base)))->m_kind; + } + case ASR::ttypeType::RealPointer : { + return ((ASR::RealPointer_t*)(&(curr_type->base)))->m_kind; + } + case ASR::ttypeType::Integer : { + return ((ASR::Integer_t*)(&(curr_type->base)))->m_kind; + } + case ASR::ttypeType::IntegerPointer : { + return ((ASR::IntegerPointer_t*)(&(curr_type->base)))->m_kind; + } + case ASR::ttypeType::Complex: { + return ((ASR::Complex_t*)(&(curr_type->base)))->m_kind; + } + case ASR::ttypeType::ComplexPointer: { + return ((ASR::ComplexPointer_t*)(&(curr_type->base)))->m_kind; + } + default : { + return -1; + } + } + } }; class ImplicitCastRules { @@ -114,6 +147,7 @@ namespace LFortran { static const int real_to_complex = ASR::cast_kindType::RealToComplex; static const int integer_to_complex = ASR::cast_kindType::IntegerToComplex; static const int integer_to_logical = ASR::cast_kindType::IntegerToLogical; + static const int complex_to_complex = ASR::cast_kindType::ComplexToComplex; static const int real_to_real = ASR::cast_kindType::RealToReal; //! Stores the variable part of error messages to be passed to SemanticError. @@ -144,8 +178,8 @@ namespace LFortran { integer_to_integer, integer_to_real, integer_to_complex, error_case, integer_to_logical, error_case}, {real_to_integer, real_to_real, real_to_complex, default_case, default_case, default_case, real_to_integer, real_to_real, real_to_complex, default_case, default_case, default_case}, - {default_case, default_case, default_case, default_case, default_case, default_case, - default_case, default_case, default_case, default_case, default_case, default_case}, + {default_case, default_case, complex_to_complex, default_case, default_case, default_case, + default_case, default_case, complex_to_complex, default_case, default_case, default_case}, {default_case, default_case, default_case, default_case, default_case, default_case, default_case, default_case, default_case, default_case, default_case, default_case}, {default_case, default_case, default_case, default_case, default_case, default_case, @@ -192,30 +226,8 @@ namespace LFortran { dest_type = temp; } int source_kind = 0, dest_kind = 1; - switch (dest_type->type) { - - case ASR::ttypeType::Real : { - source_kind = ((ASR::Real_t*)(&(source_type->base)))->m_kind; - dest_kind = ((ASR::Real_t*)(&(dest_type->base)))->m_kind; - break; - } case ASR::ttypeType::RealPointer : { - source_kind = ((ASR::Real_t*)(&(source_type->base)))->m_kind; - dest_kind = ((ASR::RealPointer_t*)(&(dest_type->base)))->m_kind; - break; - } case ASR::ttypeType::Integer : { - source_kind = ((ASR::Integer_t*)(&(source_type->base)))->m_kind; - dest_kind = ((ASR::Integer_t*)(&(dest_type->base)))->m_kind; - break; - } case ASR::ttypeType::IntegerPointer : { - source_kind = ((ASR::Integer_t*)(&(source_type->base)))->m_kind; - dest_kind = ((ASR::IntegerPointer_t*)(&(dest_type->base)))->m_kind; - break; - } - default : { - break; - } - - } + source_kind = HelperMethods::extract_kind_from_ttype_t(source_type); + dest_kind = HelperMethods::extract_kind_from_ttype_t(dest_type); if( source_kind == dest_kind ) { return ; } @@ -296,6 +308,7 @@ class SymbolTableVisitor : public AST::BaseVisitor std::map> generic_procedures; ASR::accessType dflt_access = ASR::Public; std::map assgnd_access; + Vec current_module_dependencies; SymbolTableVisitor(Allocator &al, SymbolTable *symbol_table) : al{al}, current_scope{symbol_table} { } @@ -328,6 +341,7 @@ class SymbolTableVisitor : public AST::BaseVisitor void visit_Module(const AST::Module_t &x) { SymbolTable *parent_scope = current_scope; current_scope = al.make_new(parent_scope); + current_module_dependencies.reserve(al, 4); for (size_t i=0; i asr = ASR::make_Module_t( al, x.base.base.loc, /* a_symtab */ current_scope, - /* a_name */ x.m_name); + /* a_name */ x.m_name, + current_module_dependencies.p, + current_module_dependencies.n, + false); std::string sym_name = x.m_name; if (parent_scope->scope.find(sym_name) != parent_scope->scope.end()) { throw SemanticError("Module already defined", asr->loc); @@ -353,6 +370,7 @@ class SymbolTableVisitor : public AST::BaseVisitor void visit_Program(const AST::Program_t &x) { SymbolTable *parent_scope = current_scope; current_scope = al.make_new(parent_scope); + current_module_dependencies.reserve(al, 4); for (size_t i=0; i al, x.base.base.loc, /* a_symtab */ current_scope, /* a_name */ x.m_name, + current_module_dependencies.p, + current_module_dependencies.n, /* a_body */ nullptr, /* n_body */ 0); std::string sym_name = x.m_name; @@ -629,12 +649,108 @@ class SymbolTableVisitor : public AST::BaseVisitor } } + std::string read_file(const std::string &filename) + { + std::ifstream ifs(filename.c_str(), std::ios::in | std::ios::binary + | std::ios::ate); + + std::ifstream::pos_type filesize = ifs.tellg(); + if (filesize < 0) return std::string(); + + ifs.seekg(0, std::ios::beg); + + std::vector bytes(filesize); + ifs.read(&bytes[0], filesize); + + return std::string(&bytes[0], filesize); + } + + ASR::TranslationUnit_t* find_and_load_module(const std::string &msym, + SymbolTable &symtab) { + std::string modfile = read_file(msym + ".mod"); + if (modfile == "") return nullptr; + ASR::TranslationUnit_t *asr = load_modfile(al, modfile, false, + symtab); + return asr; + } + + ASR::Module_t* extract_module(const ASR::TranslationUnit_t &m) { + LFORTRAN_ASSERT(m.m_global_scope->scope.size()== 1); + for (auto &a : m.m_global_scope->scope) { + LFORTRAN_ASSERT(ASR::is_a(*a.second)); + return ASR::down_cast(a.second); + } + throw LFortranException("ICE: Module not found"); + } + + bool present(Vec &v, const char* name) { + for (auto &a : v) { + if (std::string(a) == std::string(name)) { + return true; + } + } + return false; + } + void visit_Use(const AST::Use_t &x) { std::string msym = x.m_module; + if (!present(current_module_dependencies, x.m_module)) { + current_module_dependencies.push_back(al, x.m_module); + } ASR::symbol_t *t = current_scope->parent->resolve_symbol(msym); if (!t) { - throw SemanticError("Module '" + msym + "' not declared", - x.base.base.loc); + ASR::TranslationUnit_t *mod1 = find_and_load_module(msym, + *current_scope->parent); + if (mod1 == nullptr) { + throw SemanticError("Module '" + msym + "' not declared in the current source and the modfile was not found", + x.base.base.loc); + } + ASR::Module_t *mod2 = extract_module(*mod1); + current_scope->parent->scope[msym] = (ASR::symbol_t*)mod2; + mod2->m_symtab->parent = current_scope->parent; + mod2->m_loaded_from_mod = true; + t = current_scope->parent->resolve_symbol(msym); + LFORTRAN_ASSERT(t != nullptr); + + // Create a temporary TranslationUnit just for fixing the symbols + ASR::TranslationUnit_t *tu + = ASR::down_cast2(ASR::make_TranslationUnit_t(al, x.base.base.loc, + current_scope->parent, nullptr, 0)); + + // Load any dependent modules + std::vector modules_list + = determine_module_dependencies(*tu); + for (auto &item : modules_list) { + if (current_scope->parent->scope.find(item) + == current_scope->parent->scope.end()) { + // A module that was loaded requires to load another + // module + ASR::TranslationUnit_t *mod1 = find_and_load_module(item, + *current_scope->parent); + if (mod1 == nullptr) { + throw SemanticError("Module '" + item + "' modfile was not found", + x.base.base.loc); + } + ASR::Module_t *mod2 = extract_module(*mod1); + current_scope->parent->scope[item] = (ASR::symbol_t*)mod2; + mod2->m_symtab->parent = current_scope->parent; + mod2->m_loaded_from_mod = true; + } + } + + // Check that all modules are included in ASR now + modules_list = determine_module_dependencies(*tu); + for (auto &item : modules_list) { + if (current_scope->parent->scope.find(item) + == current_scope->parent->scope.end()) { + throw SemanticError("ICE: Module '" + item + "' modfile was not found, but should have", + x.base.base.loc); + } + } + + // Fix all external symbols + fix_external_symbols(*tu, *current_scope->parent); + LFORTRAN_ASSERT(asr_verify(*tu)); } if (!ASR::is_a(*t)) { throw SemanticError("The symbol '" + msym + "' must be a module", @@ -653,6 +769,7 @@ class SymbolTableVisitor : public AST::BaseVisitor /* a_symtab */ current_scope, /* a_name */ msub->m_name, (ASR::symbol_t*)msub, + m->m_name, msub->m_name, dflt_access ); std::string sym = msub->m_name; @@ -664,6 +781,7 @@ class SymbolTableVisitor : public AST::BaseVisitor /* a_symtab */ current_scope, /* a_name */ mfn->m_name, (ASR::symbol_t*)mfn, + m->m_name, mfn->m_name, dflt_access ); std::string sym = mfn->m_name; @@ -695,7 +813,7 @@ class SymbolTableVisitor : public AST::BaseVisitor } ASR::Subroutine_t *msub = ASR::down_cast(t); // `msub` is the Subroutine in a module. Now we construct - // a new Subroutine that is just the prototype, and that links to + // an ExternalSymbol that points to // `msub` via the `external` field. Str name; name.from_str(al, local_sym); @@ -704,6 +822,7 @@ class SymbolTableVisitor : public AST::BaseVisitor /* a_symtab */ current_scope, /* a_name */ name.c_str(al), (ASR::symbol_t*)msub, + m->m_name, msub->m_name, dflt_access ); current_scope->scope[local_sym] = ASR::down_cast(sub); @@ -712,13 +831,16 @@ class SymbolTableVisitor : public AST::BaseVisitor throw SemanticError("Symbol already defined", x.base.base.loc); } + ASR::GenericProcedure_t *gp = ASR::down_cast(t); Str name; name.from_str(al, local_sym); + char *cname = name.c_str(al); ASR::asr_t *ep = ASR::make_ExternalSymbol_t( al, t->base.loc, current_scope, - /* a_name */ name.c_str(al), + /* a_name */ cname, t, + m->m_name, gp->m_name, dflt_access ); current_scope->scope[local_sym] = ASR::down_cast(ep); @@ -729,15 +851,16 @@ class SymbolTableVisitor : public AST::BaseVisitor } ASR::Function_t *mfn = ASR::down_cast(t); // `msub` is the Function in a module. Now we construct - // a new Function that is just the prototype, and that links to - // `mfn` via the `external` field. + // an ExternalSymbol that points to it. Str name; name.from_str(al, local_sym); + char *cname = name.c_str(al); ASR::asr_t *fn = ASR::make_ExternalSymbol_t( al, mfn->base.base.loc, /* a_symtab */ current_scope, - /* a_name */ name.c_str(al), + /* a_name */ cname, (ASR::symbol_t*)mfn, + m->m_name, mfn->m_name, dflt_access ); current_scope->scope[local_sym] = ASR::down_cast(fn); @@ -925,7 +1048,7 @@ class SymbolTableVisitor : public AST::BaseVisitor } else if (sym_type == "logical") { type = TYPE(ASR::make_Logical_t(al, x.loc, 4, dims.p, dims.size())); } else if (sym_type == "complex") { - type = TYPE(ASR::make_Complex_t(al, x.loc, 4, dims.p, dims.size())); + type = TYPE(ASR::make_Complex_t(al, x.loc, a_kind, dims.p, dims.size())); } else if (sym_type == "character") { type = TYPE(ASR::make_Character_t(al, x.loc, 4, dims.p, dims.size())); } else if (sym_type == "type") { @@ -1251,16 +1374,47 @@ class BodyVisitor : public AST::BaseVisitor case (ASR::symbolType::ExternalSymbol) : { ASR::ExternalSymbol_t *p = ASR::down_cast(original_sym); final_sym = p->m_external; - if (ASR::is_a(*final_sym)) { - throw SemanticError("Chained ExternalSymbols not supported yet", x.base.base.loc); - } + // Enforced by verify(), but we ensure anyway that + // ExternalSymbols are not chained: + LFORTRAN_ASSERT(!ASR::is_a(*final_sym)) if (ASR::is_a(*final_sym)) { - ASR::GenericProcedure_t *p = ASR::down_cast(final_sym); - int idx = select_generic_procedure(args, *p, x.base.base.loc); - final_sym = p->m_procs[idx]; - } - if (!ASR::is_a(*final_sym)) { - throw SemanticError("ExternalSymbol must point to a Subroutine", x.base.base.loc); + ASR::GenericProcedure_t *g = ASR::down_cast(final_sym); + int idx = select_generic_procedure(args, *g, x.base.base.loc); + // FIXME + // Create ExternalSymbol for the final subroutine here + final_sym = g->m_procs[idx]; + if (!ASR::is_a(*final_sym)) { + throw SemanticError("ExternalSymbol must point to a Subroutine", x.base.base.loc); + } + // We mangle the new ExternalSymbol's local name as: + // generic_procedure_local_name @ + // specific_procedure_remote_name + std::string local_sym = std::string(p->m_name) + "@" + + symbol_name(final_sym); + if (current_scope->scope.find(local_sym) + == current_scope->scope.end()) { + Str name; + name.from_str(al, local_sym); + char *cname = name.c_str(al); + ASR::asr_t *sub = ASR::make_ExternalSymbol_t( + al, p->base.base.loc, + /* a_symtab */ current_scope, + /* a_name */ cname, + final_sym, + p->m_module_name, symbol_name(final_sym), + ASR::accessType::Private + ); + final_sym = ASR::down_cast(sub); + current_scope->scope[local_sym] = final_sym; + } else { + final_sym = current_scope->scope[local_sym]; + } + } else { + if (!ASR::is_a(*final_sym)) { + throw SemanticError("ExternalSymbol must point to a Subroutine", x.base.base.loc); + } + final_sym=original_sym; + original_sym = nullptr; } break; } @@ -1653,7 +1807,7 @@ class BodyVisitor : public AST::BaseVisitor Vec args = visit_expr_list(x.m_args, x.n_args); ASR::ttype_t *type; type = EXPR2VAR(ASR::down_cast(v)->m_return_var)->m_type; - tmp = ASR::make_FuncCall_t(al, x.base.base.loc, + tmp = ASR::make_FunctionCall_t(al, x.base.base.loc, v, nullptr, args.p, args.size(), nullptr, 0, type); break; } @@ -1663,8 +1817,8 @@ class BodyVisitor : public AST::BaseVisitor ASR::symbol_t *f2 = ASR::down_cast(v)->m_external; LFORTRAN_ASSERT(f2); type = EXPR2VAR(ASR::down_cast(f2)->m_return_var)->m_type; - tmp = ASR::make_FuncCall_t(al, x.base.base.loc, - f2, v, args.p, args.size(), nullptr, 0, type); + tmp = ASR::make_FunctionCall_t(al, x.base.base.loc, + v, nullptr, args.p, args.size(), nullptr, 0, type); break; } case (ASR::symbolType::Variable) : { @@ -1716,12 +1870,14 @@ class BodyVisitor : public AST::BaseVisitor } void visit_Complex(const AST::Complex_t &x) { - ASR::ttype_t *type = TYPE(ASR::make_Complex_t(al, x.base.base.loc, - 4, nullptr, 0)); this->visit_expr(*x.m_re); ASR::expr_t *re = EXPR(tmp); + int a_kind_r = HelperMethods::extract_kind_from_ttype_t(expr_type(re)); this->visit_expr(*x.m_im); ASR::expr_t *im = EXPR(tmp); + int a_kind_i = HelperMethods::extract_kind_from_ttype_t(expr_type(im)); + ASR::ttype_t *type = TYPE(ASR::make_Complex_t(al, x.base.base.loc, + std::max(a_kind_r, a_kind_i), nullptr, 0)); // Extract kind here. tmp = ASR::make_ConstantComplex_t(al, x.base.base.loc, re, im, type); } @@ -1924,7 +2080,9 @@ ASR::TranslationUnit_t *ast_to_asr(Allocator &al, AST::TranslationUnit_t &ast, BodyVisitor b(al, unit); b.visit_TranslationUnit(ast); - return ASR::down_cast2(unit); + ASR::TranslationUnit_t *tu = ASR::down_cast2(unit); + LFORTRAN_ASSERT(asr_verify(*tu)); + return tu; } } // namespace LFortran diff --git a/src/lfortran/serialization.cpp b/src/lfortran/serialization.cpp new file mode 100644 index 0000000000..8bc1a7f569 --- /dev/null +++ b/src/lfortran/serialization.cpp @@ -0,0 +1,444 @@ +#include + +#include +#include +#include +#include +#include + + +namespace LFortran { + +std::string uint64_to_string(uint64_t i) { + char bytes[4]; + bytes[0] = (i >> 24) & 0xFF; + bytes[1] = (i >> 16) & 0xFF; + bytes[2] = (i >> 8) & 0xFF; + bytes[3] = i & 0xFF; + return std::string(bytes, 4); +} + +uint64_t string_to_uint64(const char *s) { + // The cast from signed char to unsigned char is important, + // otherwise the signed char shifts return wrong value for negative numbers + const uint8_t *p = (const unsigned char*)s; + return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; +} + +uint64_t string_to_uint64(const std::string &s) { + return string_to_uint64(&s[0]); +} + +class ASTSerializationVisitor : public + AST::SerializationBaseVisitor +{ +private: + std::string s; +public: + std::string get_str() { + return s; + } + + void write_int8(uint8_t i) { + char c=i; + s.append(std::string(&c, 1)); + } + + void write_int64(uint64_t i) { + s.append(uint64_to_string(i)); + } + + void write_bool(bool b) { + if (b) { + write_int8(1); + } else { + write_int8(0); + } + } + + void write_string(const std::string &t) { + write_int64(t.size()); + s.append(t); + } +}; + +std::string serialize(const AST::ast_t &ast) { + ASTSerializationVisitor v; + v.write_int8(ast.type); + v.visit_ast(ast); + return v.get_str(); +} + +std::string serialize(const AST::TranslationUnit_t &unit) { + return serialize((AST::ast_t&)(unit)); +} + +class ASTDeserializationVisitor : public + AST::DeserializationBaseVisitor +{ +private: + std::string s; + size_t pos; +public: + ASTDeserializationVisitor(Allocator &al, const std::string &s) : + DeserializationBaseVisitor(al, true), s{s}, pos{0} {} + + uint8_t read_int8() { + if (pos+1 > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + uint8_t n = s[pos]; + pos += 1; + return n; + } + + uint64_t read_int64() { + if (pos+4 > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + uint64_t n = string_to_uint64(&s[pos]); + pos += 4; + return n; + } + + bool read_bool() { + uint8_t b = read_int8(); + return (b == 1); + } + + std::string read_string() { + size_t n = read_int64(); + if (pos+n > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + std::string r = std::string(&s[pos], n); + pos += n; + return r; + } + + char* read_cstring() { + std::string s = read_string(); + LFortran::Str cs; + cs.from_str_view(s); + char* p = cs.c_str(al); + return p; + } +}; + +AST::ast_t* deserialize_ast(Allocator &al, const std::string &s) { + ASTDeserializationVisitor v(al, s); + return v.deserialize_node(); +} + +// ---------------------------------------------------------------- + +class ASRSerializationVisitor : public + ASR::SerializationBaseVisitor +{ +private: + std::string s; +public: + std::string get_str() { + return s; + } + + void write_int8(uint8_t i) { + char c=i; + s.append(std::string(&c, 1)); + } + + void write_int64(uint64_t i) { + s.append(uint64_to_string(i)); + } + + void write_bool(bool b) { + if (b) { + write_int8(1); + } else { + write_int8(0); + } + } + + void write_string(const std::string &t) { + write_int64(t.size()); + s.append(t); + } + + void write_symbol(const ASR::symbol_t &x) { + write_int64(symbol_parent_symtab(&x)->counter); + write_int8(x.type); + write_string(symbol_name(&x)); + } +}; + +std::string serialize(const ASR::asr_t &asr) { + ASRSerializationVisitor v; + v.write_int8(asr.type); + v.visit_asr(asr); + return v.get_str(); +} + +std::string serialize(const ASR::TranslationUnit_t &unit) { + return serialize((ASR::asr_t&)(unit)); +} + +class ASRDeserializationVisitor : public + ASR::DeserializationBaseVisitor +{ +private: + std::string s; + size_t pos; +public: + ASRDeserializationVisitor(Allocator &al, const std::string &s, + bool load_symtab_id) : + DeserializationBaseVisitor(al, load_symtab_id), s{s}, pos{0} {} + + uint8_t read_int8() { + if (pos+1 > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + uint8_t n = s[pos]; + pos += 1; + return n; + } + + uint64_t read_int64() { + if (pos+4 > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + uint64_t n = string_to_uint64(&s[pos]); + pos += 4; + return n; + } + + bool read_bool() { + uint8_t b = read_int8(); + return (b == 1); + } + + std::string read_string() { + size_t n = read_int64(); + if (pos+n > s.size()) { + throw LFortranException("String is too short for deserialization."); + } + std::string r = std::string(&s[pos], n); + pos += n; + return r; + } + + char* read_cstring() { + std::string s = read_string(); + LFortran::Str cs; + cs.from_str_view(s); + char* p = cs.c_str(al); + return p; + } + +#define READ_SYMBOL_CASE(x) \ + case (ASR::symbolType::x) : { \ + s = (ASR::symbol_t*)al.make_new(); \ + s->type = ASR::symbolType::x; \ + s->base.type = ASR::asrType::symbol; \ + s->base.loc.first_line = 123; \ + break; \ + } + +#define INSERT_SYMBOL_CASE(x) \ + case (ASR::symbolType::x) : { \ + memcpy(sym2, sym, sizeof(ASR::x##_t)); \ + break; \ + } + + ASR::symbol_t *read_symbol() { + uint64_t symtab_id = read_int64(); + uint64_t symbol_type = read_int8(); + std::string symbol_name = read_string(); + LFORTRAN_ASSERT(id_symtab_map.find(symtab_id) != id_symtab_map.end()); + SymbolTable *symtab = id_symtab_map[symtab_id]; + if (symtab->scope.find(symbol_name) == symtab->scope.end()) { + // Symbol is not in the symbol table yet. We construct an empty + // symbol of the correct type and put it in the symbol table. + // Later when constructing the symbol table, we will check for this + // and fill it in correctly. + ASR::symbolType ty = static_cast(symbol_type); + ASR::symbol_t *s; + switch (ty) { + READ_SYMBOL_CASE(Program) + READ_SYMBOL_CASE(Module) + READ_SYMBOL_CASE(Subroutine) + READ_SYMBOL_CASE(Function) + READ_SYMBOL_CASE(GenericProcedure) + READ_SYMBOL_CASE(ExternalSymbol) + READ_SYMBOL_CASE(DerivedType) + READ_SYMBOL_CASE(Variable) + default : throw LFortranException("Symbol type not supported"); + } + symtab->scope[symbol_name] = s; + } + ASR::symbol_t *sym = symtab->scope[symbol_name]; + return sym; + } + + void symtab_insert_symbol(SymbolTable &symtab, const std::string &name, + ASR::symbol_t *sym) { + if (symtab.scope.find(name) == symtab.scope.end()) { + symtab.scope[name] = sym; + } else { + // We have to copy the contents of `sym` into `sym2` without + // changing the `sym2` pointer already in the table + ASR::symbol_t *sym2 = symtab.scope[name]; + LFORTRAN_ASSERT(sym2->base.loc.first_line == 123); + switch (sym->type) { + INSERT_SYMBOL_CASE(Program) + INSERT_SYMBOL_CASE(Module) + INSERT_SYMBOL_CASE(Subroutine) + INSERT_SYMBOL_CASE(Function) + INSERT_SYMBOL_CASE(GenericProcedure) + INSERT_SYMBOL_CASE(ExternalSymbol) + INSERT_SYMBOL_CASE(DerivedType) + INSERT_SYMBOL_CASE(Variable) + default : throw LFortranException("Symbol type not supported"); + } + } + } +}; + +namespace ASR { + +class FixParentSymtabVisitor : public BaseWalkVisitor +{ +private: + SymbolTable *current_symtab; +public: + void visit_TranslationUnit(const TranslationUnit_t &x) { + current_symtab = x.m_global_scope; + for (auto &a : x.m_global_scope->scope) { + this->visit_symbol(*a.second); + } + } + + void visit_Program(const Program_t &x) { + SymbolTable *parent_symtab = current_symtab; + current_symtab = x.m_symtab; + x.m_symtab->parent = parent_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + current_symtab = parent_symtab; + } + + void visit_Module(const Module_t &x) { + SymbolTable *parent_symtab = current_symtab; + current_symtab = x.m_symtab; + x.m_symtab->parent = parent_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + current_symtab = parent_symtab; + } + + void visit_Subroutine(const Subroutine_t &x) { + SymbolTable *parent_symtab = current_symtab; + current_symtab = x.m_symtab; + x.m_symtab->parent = parent_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + current_symtab = parent_symtab; + } + + void visit_Function(const Function_t &x) { + SymbolTable *parent_symtab = current_symtab; + current_symtab = x.m_symtab; + x.m_symtab->parent = parent_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + current_symtab = parent_symtab; + } + + void visit_DerivedType(const DerivedType_t &x) { + SymbolTable *parent_symtab = current_symtab; + current_symtab = x.m_symtab; + x.m_symtab->parent = parent_symtab; + for (auto &a : x.m_symtab->scope) { + this->visit_symbol(*a.second); + } + current_symtab = parent_symtab; + } + +}; + +class FixExternalSymbolsVisitor : public BaseWalkVisitor +{ +private: + SymbolTable *global_symtab; + SymbolTable *external_symtab; +public: + FixExternalSymbolsVisitor(SymbolTable &symtab) : external_symtab{&symtab} {} + + void visit_TranslationUnit(const TranslationUnit_t &x) { + global_symtab = x.m_global_scope; + for (auto &a : x.m_global_scope->scope) { + this->visit_symbol(*a.second); + } + } + + void visit_ExternalSymbol(const ExternalSymbol_t &x) { + LFORTRAN_ASSERT(x.m_external == nullptr); + std::string module_name = x.m_module_name; + std::string original_name = x.m_original_name; + if (global_symtab->scope.find(module_name) != global_symtab->scope.end()) { + Module_t *m = down_cast(global_symtab->scope[module_name]); + if (m->m_symtab->scope.find(original_name) != m->m_symtab->scope.end()) { + symbol_t *sym = m->m_symtab->scope[original_name]; + // FIXME: this is a hack, we need to pass in a non-const `x`. + ExternalSymbol_t &xx = const_cast(x); + xx.m_external = sym; + return; + } + } else if (external_symtab->scope.find(module_name) != external_symtab->scope.end()) { + Module_t *m = down_cast(external_symtab->scope[module_name]); + if (m->m_symtab->scope.find(original_name) != m->m_symtab->scope.end()) { + symbol_t *sym = m->m_symtab->scope[original_name]; + // FIXME: this is a hack, we need to pass in a non-const `x`. + ExternalSymbol_t &xx = const_cast(x); + xx.m_external = sym; + return; + } + } + throw LFortranException("ExternalSymbol cannot be resolved"); + } + + +}; + +} // namespace ASR + +// Fix ExternalSymbol's symbol to point to symbols from `external_symtab` +// or from `unit`. +void fix_external_symbols(ASR::TranslationUnit_t &unit, + SymbolTable &external_symtab) { + ASR::FixExternalSymbolsVisitor e(external_symtab); + e.visit_TranslationUnit(unit); +} + +ASR::asr_t* deserialize_asr(Allocator &al, const std::string &s, + bool load_symtab_id, SymbolTable &external_symtab) { + ASRDeserializationVisitor v(al, s, load_symtab_id); + ASR::asr_t *node = v.deserialize_node(); + ASR::TranslationUnit_t *tu = ASR::down_cast2(node); + + // Connect the `parent` member of symbol tables + ASR::FixParentSymtabVisitor p; + p.visit_TranslationUnit(*tu); + + LFORTRAN_ASSERT(asr_verify(*tu, false)); + + // Suppress a warning for now + if ((bool&)external_symtab) {} + + return node; +} + +} // namespace LFortran diff --git a/src/lfortran/serialization.h b/src/lfortran/serialization.h new file mode 100644 index 0000000000..4dfeda9afb --- /dev/null +++ b/src/lfortran/serialization.h @@ -0,0 +1,27 @@ +#ifndef LFORTRAN_SERIALIZATION_H +#define LFORTRAN_SERIALIZATION_H + +#include +#include +#include + +namespace LFortran { + + std::string serialize(const AST::ast_t &ast); + std::string serialize(const AST::TranslationUnit_t &unit); + AST::ast_t* deserialize_ast(Allocator &al, const std::string &s); + + std::string serialize(const ASR::asr_t &asr); + std::string serialize(const ASR::TranslationUnit_t &unit); + ASR::asr_t* deserialize_asr(Allocator &al, const std::string &s, + bool load_symtab_id, SymbolTable &symtab); + + std::string uint64_to_string(uint64_t i); + uint64_t string_to_uint64(const std::string &s); + uint64_t string_to_uint64(const char *s); + + void fix_external_symbols(ASR::TranslationUnit_t &unit, + SymbolTable &external_symtab); +} + +#endif // LFORTRAN_SERIALIZATION_H diff --git a/src/lfortran/stacktrace.cpp b/src/lfortran/stacktrace.cpp index b240f5b985..7099fa8268 100644 --- a/src/lfortran/stacktrace.cpp +++ b/src/lfortran/stacktrace.cpp @@ -561,22 +561,23 @@ void address_to_line_number(const std::vector &filenames, uintptr_t address, std::string &filename, int &line_number) { + uintptr_t actual_address = address-16; int n = addresses.size() / 3; // Bisection-Search int start_ind = 0, end_ind = n-1; - if (addresses[3*start_ind] > (address-8)) { + if (addresses[3*start_ind] > actual_address) { line_number = addresses[3*start_ind+1]; filename = filenames[addresses[3*start_ind+2]]; return; } - if (addresses[3*end_ind] < (address-8)) { + if (addresses[3*end_ind] < actual_address) { line_number = -1; filename = ""; return; } while (start_ind+1 < end_ind) { int mid = (start_ind + end_ind)/2; - if (addresses[3*mid] > (address-8)) { + if (addresses[3*mid] > actual_address) { end_ind = mid; } else { start_ind = mid; diff --git a/src/lfortran/tests/CMakeLists.txt b/src/lfortran/tests/CMakeLists.txt index 3ce8a34d4d..7a42faab66 100644 --- a/src/lfortran/tests/CMakeLists.txt +++ b/src/lfortran/tests/CMakeLists.txt @@ -43,6 +43,8 @@ endif() ADDTEST(test_stacktrace) +ADDTEST(test_stacktrace2 p::doctest) + ADDTEST(test_asm p::doctest) -ADDTEST(test_stacktrace2 p::doctest) +ADDTEST(test_serialization p::doctest) diff --git a/src/lfortran/tests/test_ast.cpp b/src/lfortran/tests/test_ast.cpp index 23a7e4f362..2e96049693 100644 --- a/src/lfortran/tests/test_ast.cpp +++ b/src/lfortran/tests/test_ast.cpp @@ -5,6 +5,9 @@ #include #include #include +#include +#include +#include namespace LFortran { @@ -27,4 +30,33 @@ TEST_CASE("Test types") { } +TEST_CASE("ASR Verify") { + Allocator al(4*1024); + + std::string src = R"""( +program expr2 +implicit none +integer :: x +x = (2+3)*5 +print *, x +end program +)"""; + + AST::TranslationUnit_t* ast = LFortran::parse2(al, src); + ASR::TranslationUnit_t* asr = LFortran::ast_to_asr(al, *ast); + + CHECK(asr_verify(*asr)); // Passes + + // Extract the variable "x" from the "x = (2+3)*5" line: + ASR::Program_t *prog = ASR::down_cast(asr->m_global_scope->scope["expr2"]); + ASR::Assignment_t *a = ASR::down_cast(prog->m_body[0]); + ASR::Var_t *v = ASR::down_cast(a->m_target); + + v->m_v = &(prog->base); // Assign the wrong symbol to Var_t::m_v + + // This will be caught by the verifier + CHECK_THROWS_AS(asr_verify(*asr), LFortranException); +} + + } // namespace LFortran diff --git a/src/lfortran/tests/test_llvm.cpp b/src/lfortran/tests/test_llvm.cpp index c9c33555c0..b578bb04c3 100644 --- a/src/lfortran/tests/test_llvm.cpp +++ b/src/lfortran/tests/test_llvm.cpp @@ -793,4 +793,34 @@ TEST_CASE("FortranEvaluator 8") { CHECK(r.ok); CHECK(r.result.type == FortranEvaluator::EvalResult::real); CHECK(r.result.f == 3.5); -} \ No newline at end of file +} + +TEST_CASE("FortranEvaluator integer kind 1") { + FortranEvaluator e; + FortranEvaluator::Result + r = e.evaluate("integer(4) :: i"); + CHECK(r.ok); + CHECK(r.result.type == FortranEvaluator::EvalResult::none); + r = e.evaluate("i = 5"); + CHECK(r.ok); + CHECK(r.result.type == FortranEvaluator::EvalResult::statement); + r = e.evaluate("i"); + CHECK(r.ok); + CHECK(r.result.type == FortranEvaluator::EvalResult::integer); + CHECK(r.result.i == 5); +} + +TEST_CASE("FortranEvaluator integer kind 2") { + FortranEvaluator e; + FortranEvaluator::Result + r = e.evaluate("integer(8) :: i"); + CHECK(r.ok); + CHECK(r.result.type == FortranEvaluator::EvalResult::none); + r = e.evaluate("i = 5"); + CHECK(r.ok); + CHECK(r.result.type == FortranEvaluator::EvalResult::statement); + r = e.evaluate("i"); + CHECK(r.ok); + CHECK(r.result.type == FortranEvaluator::EvalResult::integer); + CHECK(r.result.i == 5); +} diff --git a/src/lfortran/tests/test_serialization.cpp b/src/lfortran/tests/test_serialization.cpp new file mode 100644 index 0000000000..f17a5144ee --- /dev/null +++ b/src/lfortran/tests/test_serialization.cpp @@ -0,0 +1,330 @@ +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +using LFortran::string_to_uint64; +using LFortran::uint64_to_string; + +TEST_CASE("Integer conversion") { + uint64_t i; + i = 1; + CHECK(string_to_uint64(uint64_to_string(i)) == i); + + i = 150; + CHECK(string_to_uint64(uint64_to_string(i)) == i); + + i = 256; + CHECK(string_to_uint64(uint64_to_string(i)) == i); + + i = 65537; + CHECK(string_to_uint64(uint64_to_string(i)) == i); + + i = 16777217; + CHECK(string_to_uint64(uint64_to_string(i)) == i); + + i = 18446744073709551615LLU; + CHECK(string_to_uint64(uint64_to_string(i)) == i); +} + +void ast_ser(const std::string &src) { + Allocator al(4*1024); + + LFortran::AST::TranslationUnit_t* result; + result = LFortran::parse2(al, src); + std::string ast_orig = LFortran::pickle(*result); + std::string binary = LFortran::serialize(*result); + + LFortran::AST::ast_t *ast; + ast = LFortran::deserialize_ast(al, binary); + CHECK(LFortran::AST::is_a(*ast)); + + std::string ast_new = LFortran::pickle(*ast); + + CHECK(ast_orig == ast_new); +} + +void asr_ser(const std::string &src) { + Allocator al(4*1024); + + LFortran::AST::TranslationUnit_t* ast0; + ast0 = LFortran::parse2(al, src); + LFortran::ASR::TranslationUnit_t* asr = LFortran::ast_to_asr(al, *ast0); + + std::string asr_orig = LFortran::pickle(*asr); + std::string binary = LFortran::serialize(*asr); + + LFortran::ASR::asr_t *asr_new0; + LFortran::SymbolTable symtab(nullptr); + asr_new0 = LFortran::deserialize_asr(al, binary, true, symtab); + CHECK(LFortran::ASR::is_a(*asr_new0)); + LFortran::ASR::TranslationUnit_t *tu + = LFortran::ASR::down_cast2(asr_new0); + fix_external_symbols(*tu, symtab); + LFORTRAN_ASSERT(LFortran::asr_verify(*tu)); + + std::string asr_new = LFortran::pickle(*asr_new0); + + CHECK(asr_orig == asr_new); +} + +void asr_mod(const std::string &src) { + Allocator al(4*1024); + + LFortran::AST::TranslationUnit_t* ast0; + ast0 = LFortran::parse2(al, src); + LFortran::ASR::TranslationUnit_t* asr = LFortran::ast_to_asr(al, *ast0); + + std::string modfile = LFortran::save_modfile(*asr); + LFortran::SymbolTable symtab(nullptr); + LFortran::ASR::TranslationUnit_t *asr2 = LFortran::load_modfile(al, + modfile, true, symtab); + fix_external_symbols(*asr2, symtab); + LFORTRAN_ASSERT(LFortran::asr_verify(*asr2)); + + CHECK(LFortran::pickle(*asr) == LFortran::pickle(*asr2)); +} + +TEST_CASE("AST Tests") { + ast_ser("x = 2+2**2"); + + ast_ser(R"""( +x = 2+2**2 +)"""); + + ast_ser("r = a - 2*x"); + + ast_ser("r = f(a) - 2*x"); + + ast_ser(R"""( +program expr2 +implicit none +integer :: x +x = (2+3)*5 +print *, x +end program +)"""); + + ast_ser(R"""( +integer function f(a, b) result(r) +integer, intent(in) :: a, b +r = a + b +end function +)"""); + + ast_ser(R"""( +module modules_05_mod +implicit none +! TODO: the following line does not work yet +!private +integer, parameter, public :: a = 5 +integer, parameter :: b = 6 +integer, parameter :: c = 7 +public :: c +end module + + +program modules_05 +use modules_05_mod, only: a, c +print *, a, c +end program +)"""); + + ast_ser(R"""( +program doconcurrentloop_01 +implicit none +real, dimension(10000) :: a, b, c +real :: scalar +integer :: i, nsize +scalar = 10 +nsize = size(a) +do concurrent (i = 1:nsize) + a(i) = 5 + b(i) = 5 +end do +call triad(a, b, scalar, c) +print *, "End Stream Triad" + +contains + + subroutine triad(a, b, scalar, c) + real, intent(in) :: a(:), b(:), scalar + real, intent(out) :: c(:) + integer :: N, i + N = size(a) + do concurrent (i = 1:N) + c(i) = a(i) + scalar * b(i) + end do + end subroutine + +end program +)"""); + +} + +TEST_CASE("ASR Tests") { + asr_ser(R"""( +program expr2 +implicit none +integer :: x +x = (2+3)*5 +print *, x +end program +)"""); + + asr_ser(R"""( +integer function f(a, b) result(r) +integer, intent(in) :: a, b +r = a + b +end function +)"""); + + asr_ser(R"""( +program doconcurrentloop_01 +implicit none +real, dimension(10000) :: a, b, c +real :: scalar +integer :: i, nsize +scalar = 10 +nsize = size(a) +do concurrent (i = 1:nsize) + a(i) = 5 + b(i) = 5 +end do +call triad(a, b, scalar, c) +print *, "End Stream Triad" + +contains + + subroutine triad(a, b, scalar, c) + real, intent(in) :: a(:), b(:), scalar + real, intent(out) :: c(:) + integer :: N, i + N = size(a) + do concurrent (i = 1:N) + c(i) = a(i) + scalar * b(i) + end do + end subroutine + +end program +)"""); + + asr_ser(R"""( +module a +implicit none + +contains + +subroutine b() +print *, "b()" +end subroutine + +end module + +program modules_01 +use a, only: b +implicit none + +call b() + +end +)"""); + + asr_ser(R"""( +program derived_types_03 +implicit none + +type :: X + integer :: i +end type + +type(X) :: b + +contains + + subroutine Y() + type :: A + integer :: i + end type + type(A) :: b + end subroutine + + integer function Z() + type :: A + integer :: i + end type + type(A) :: b + Z = 5 + end function + +end +)"""); + +} + +TEST_CASE("ASR modfile handling") { + asr_mod(R"""( +module a +implicit none + +contains + +subroutine b() +print *, "b()" +end subroutine + +end module +)"""); + +} + +TEST_CASE("Topological sorting int") { + std::map> deps; + // 1 depends on 2 + deps[1].push_back(2); + // 3 depends on 1, etc. + deps[3].push_back(1); + deps[2].push_back(4); + deps[3].push_back(4); + CHECK(LFortran::order_deps(deps) == std::vector({4, 2, 1, 3})); + + deps.clear(); + deps[1].push_back(2); + deps[1].push_back(3); + deps[2].push_back(4); + deps[3].push_back(4); + CHECK(LFortran::order_deps(deps) == std::vector({4, 2, 3, 1})); + + deps.clear(); + deps[1].push_back(2); + deps[3].push_back(1); + deps[3].push_back(4); + deps[4].push_back(1); + CHECK(LFortran::order_deps(deps) == std::vector({2, 1, 4, 3})); +} + +TEST_CASE("Topological sorting string") { + std::map> deps; + // A depends on B + deps["A"].push_back("B"); + // C depends on A, etc. + deps["C"].push_back("A"); + deps["B"].push_back("D"); + deps["C"].push_back("D"); + CHECK(LFortran::order_deps(deps) == std::vector( + {"D", "B", "A", "C"})); + + deps.clear(); + deps["module_a"].push_back("module_b"); + deps["module_c"].push_back("module_a"); + deps["module_c"].push_back("module_d"); + deps["module_d"].push_back("module_a"); + CHECK(LFortran::order_deps(deps) == std::vector( + {"module_b", "module_a", "module_d", "module_c"})); +} diff --git a/src/lfortran/tests/test_stacktrace2.cpp b/src/lfortran/tests/test_stacktrace2.cpp index a8c0693b7d..c46646640f 100644 --- a/src/lfortran/tests/test_stacktrace2.cpp +++ b/src/lfortran/tests/test_stacktrace2.cpp @@ -43,11 +43,11 @@ TEST_CASE("Address to line number"){ CHECK(filename=="foo2"); CHECK(line_number==15); - LFortran::address_to_line_number(filenames, addresses, 1007, filename, line_number); + LFortran::address_to_line_number(filenames, addresses, 1015, filename, line_number); CHECK(filename=="foo2"); CHECK(line_number==15); - LFortran::address_to_line_number(filenames, addresses, 1008, filename, line_number); + LFortran::address_to_line_number(filenames, addresses, 1016, filename, line_number); CHECK(filename=="foo1"); CHECK(line_number==20); diff --git a/tests/global_scope8.f90 b/tests/global_scope8.f90 new file mode 100644 index 0000000000..785444e508 --- /dev/null +++ b/tests/global_scope8.f90 @@ -0,0 +1,3 @@ +integer(4) :: x +x = 6 +x diff --git a/tests/global_scope9.f90 b/tests/global_scope9.f90 new file mode 100644 index 0000000000..c7de3c87d0 --- /dev/null +++ b/tests/global_scope9.f90 @@ -0,0 +1,3 @@ +integer(8) :: x +x = 6 +x diff --git a/tests/modules_06.f90 b/tests/modules_06.f90 new file mode 100644 index 0000000000..e8711ec5b4 --- /dev/null +++ b/tests/modules_06.f90 @@ -0,0 +1,26 @@ +module modules_06_b +implicit none +private +public b + +contains + +integer function b() +b = 5 +end function + +end module + +module modules_06_a +use modules_06_b, only: b +implicit none +private +public a + +contains + +integer function a() +a = 3 + b() +end function + +end module diff --git a/tests/reference/asr-allocate_01-f3446f6.json b/tests/reference/asr-allocate_01-f3446f6.json deleted file mode 100644 index 2692a87793..0000000000 --- a/tests/reference/asr-allocate_01-f3446f6.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "basename": "asr-allocate_01-f3446f6", - "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", - "infile": "tests/../integration_tests/allocate_01.f90", - "infile_hash": "6782e86a33c1a6e5bd90ee4274fe910d75018f128dd899351b32d3c6", - "outfile": null, - "outfile_hash": null, - "stdout": "asr-allocate_01-f3446f6.stdout", - "stdout_hash": "8b5263a0f6e25544e801f1c420f2146de93bb73c888d4ae51f646846", - "stderr": null, - "stderr_hash": null, - "returncode": 0 -} \ No newline at end of file diff --git a/tests/reference/asr-allocate_01-f3446f6.stdout b/tests/reference/asr-allocate_01-f3446f6.stdout deleted file mode 100644 index e01113db5c..0000000000 --- a/tests/reference/asr-allocate_01-f3446f6.stdout +++ /dev/null @@ -1 +0,0 @@ -(TranslationUnit (SymbolTable 1 {allocate_01: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [(() ())]) Source Public), b: (Variable 2 b Local () Default (Real 4 [(() ()) (() ())]) Source Public), c: (Variable 2 c Local () Default (Real 4 [(() ()) (() ()) (() ())]) Source Public), n: (Variable 2 n Local () Default (Integer 4 []) Source Public)}) allocate_01 [(= (Var 2 n) (ConstantInteger 10 (Integer 4 []))) (Print () []) (Print () []) (Print () [])])}) []) diff --git a/tests/reference/asr-array1-20700fb.json b/tests/reference/asr-array1-20700fb.json index cfa831752b..1d9e6a7762 100644 --- a/tests/reference/asr-array1-20700fb.json +++ b/tests/reference/asr-array1-20700fb.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-array1-20700fb.stdout", - "stdout_hash": "af6eb962bc157cea6407d06c3ab9062e35e90c21e2d49f5b20c8740c", + "stdout_hash": "e960c0f3e621faba1e273bd916a85de6c6731d5b524291f2b5429803", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-array1-20700fb.stdout b/tests/reference/asr-array1-20700fb.stdout index c153b614a5..66363ba600 100644 --- a/tests/reference/asr-array1-20700fb.stdout +++ b/tests/reference/asr-array1-20700fb.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {array1: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), b2: (Variable 2 b2 Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), b3: (Variable 2 b3 Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), d: (Variable 2 d Local () Default (Real 4 []) Source Public), e: (Variable 2 e Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 [])))]) Source Public), e2: (Variable 2 e2 Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), e3: (Variable 2 e3 Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), f: (Variable 2 f Local () Default (Integer 4 []) Source Public), g: (Variable 2 g Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), g2: (Variable 2 g2 Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 6 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), g3: (Variable 2 g3 Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public)}) array1 [])}) []) +(TranslationUnit (SymbolTable 1 {array1: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), b2: (Variable 2 b2 Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), b3: (Variable 2 b3 Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), d: (Variable 2 d Local () Default (Real 4 []) Source Public), e: (Variable 2 e Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 [])))]) Source Public), e2: (Variable 2 e2 Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), e3: (Variable 2 e3 Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 1 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), f: (Variable 2 f Local () Default (Integer 4 []) Source Public), g: (Variable 2 g Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), g2: (Variable 2 g2 Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 6 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), g3: (Variable 2 g3 Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public)}) array1 [] [])}) []) diff --git a/tests/reference/asr-array2-e7997a8.json b/tests/reference/asr-array2-e7997a8.json index 3290f710ee..32c01dcada 100644 --- a/tests/reference/asr-array2-e7997a8.json +++ b/tests/reference/asr-array2-e7997a8.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-array2-e7997a8.stdout", - "stdout_hash": "77d7726f9541c44355a9892d80b045613ebbedbd6ea531734504559e", + "stdout_hash": "eed23f2cac9f8b6656d4ed3a65a2d8527cd8ec839ccb83ff09af6424", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-array2-e7997a8.stdout b/tests/reference/asr-array2-e7997a8.stdout index 8bad7f9e0b..4e4026966c 100644 --- a/tests/reference/asr-array2-e7997a8.stdout +++ b/tests/reference/asr-array2-e7997a8.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {array2: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 [])))]) Source Public), b: (Variable 2 b Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 [])))]) Source Public), c: (Variable 2 c Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), d: (Variable 2 d Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), e: (Variable 2 e Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), f: (Variable 2 f Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 4 (Integer 4 [])))]) Source Public), g: (Variable 2 g Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), h: (Variable 2 h Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 4 (Integer 4 [])))]) Source Public), i: (Variable 2 i Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), j: (Variable 2 j Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public)}) array2 [])}) []) +(TranslationUnit (SymbolTable 1 {array2: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 [])))]) Source Public), b: (Variable 2 b Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 [])))]) Source Public), c: (Variable 2 c Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), d: (Variable 2 d Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), e: (Variable 2 e Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), f: (Variable 2 f Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 4 (Integer 4 [])))]) Source Public), g: (Variable 2 g Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public), h: (Variable 2 h Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 4 (Integer 4 [])))]) Source Public), i: (Variable 2 i Local () Default (Integer 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), j: (Variable 2 j Local () Default (Logical 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 5 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) ((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])))]) Source Public)}) array2 [] [])}) []) diff --git a/tests/reference/asr-array3-7b1ab3b.json b/tests/reference/asr-array3-7b1ab3b.json index eba97205e1..6e89d863c2 100644 --- a/tests/reference/asr-array3-7b1ab3b.json +++ b/tests/reference/asr-array3-7b1ab3b.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-array3-7b1ab3b.stdout", - "stdout_hash": "8ffca8c8603d464dd31b3f0f9391e57951e2f402c5edb4bf363e1d4e", + "stdout_hash": "d5e69a74f199875e66072b6cb931d3caa87171c343968e69b0b19f6d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-array3-7b1ab3b.stdout b/tests/reference/asr-array3-7b1ab3b.stdout index 7ddbf775a1..84a223d9f5 100644 --- a/tests/reference/asr-array3-7b1ab3b.stdout +++ b/tests/reference/asr-array3-7b1ab3b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {array3: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), b: (Variable 2 b Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public)}) array3 [(= (Var 2 a) (ImplicitCast (ArrayInitializer [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Integer 4 [])) IntegerToReal (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]))) (= (Var 2 b) (ImplicitCast (ArrayInitializer [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Integer 4 [])) IntegerToReal (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))])))])}) []) +(TranslationUnit (SymbolTable 1 {array3: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), b: (Variable 2 b Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public)}) array3 [] [(= (Var 2 a) (ImplicitCast (ArrayInitializer [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Integer 4 [])) IntegerToReal (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]))) (= (Var 2 b) (ImplicitCast (ArrayInitializer [(ConstantInteger 1 (Integer 4 [])) (ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))] (Integer 4 [])) IntegerToReal (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))])))])}) []) diff --git a/tests/reference/asr-arrays_04-d832d79.json b/tests/reference/asr-arrays_04-d832d79.json index 62207f4f0c..eb87221cf1 100644 --- a/tests/reference/asr-arrays_04-d832d79.json +++ b/tests/reference/asr-arrays_04-d832d79.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-arrays_04-d832d79.stdout", - "stdout_hash": "9ece4df2bb04d7f3bcd6f6a34b6ef1ad9855f7b53563803353ecb649", + "stdout_hash": "e070483f582eecb4faefb63dcdad111cda8c4ef639d770ae734d453b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-arrays_04-d832d79.stdout b/tests/reference/asr-arrays_04-d832d79.stdout index 62d1c2dc68..e92af061c1 100644 --- a/tests/reference/asr-arrays_04-d832d79.stdout +++ b/tests/reference/asr-arrays_04-d832d79.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {arrays_04: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), abs: (Function (SymbolTable 4 {a: (Variable 4 a In () Default (Real 4 []) Source Public), r: (Variable 4 r ReturnVar () Default (Real 4 []) Source Public)}) abs [(Var 4 a)] [(Print () [(Str "abs" (Character 8 []))]) (If (Compare (Var 4 a) Gt (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToReal (Real 4 [])) (Logical 4 [])) [(= (Var 4 r) (Var 4 a))] [(= (Var 4 r) (UnaryOp USub (Var 4 a) (Real 4 [])))])] (Var 4 r) Source Public), b: (Variable 2 b Local () Default (Real 4 []) Source Public), sum: (Function (SymbolTable 3 {a: (Variable 3 a In () Default (Real 4 [(() ())]) Source Public), i: (Variable 3 i Local () Default (Integer 4 []) Source Public), r: (Variable 3 r ReturnVar () Default (Real 4 []) Source Public)}) sum [(Var 3 a)] [(Print () [(Str "sum" (Character 8 []))]) (= (Var 3 r) (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToReal (Real 4 []))) (DoLoop ((Var 3 i) (ConstantInteger 1 (Integer 4 [])) (FuncCall 1 size () [(Var 3 a)] [] (Integer 4 [])) ()) [(= (Var 3 r) (BinOp (Var 3 r) Add (ArrayRef 3 a [(() (Var 3 i) ())] (Real 4 [(() ())])) (Real 4 [])))])] (Var 3 r) Source Public)}) arrays_04 [(= (ArrayRef 2 a [(() (ConstantInteger 1 (Integer 4 [])) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))])) (ConstantInteger 3 (Integer 4 []))) (= (ArrayRef 2 a [(() (ConstantInteger 2 (Integer 4 [])) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))])) (ConstantInteger 2 (Integer 4 []))) (= (ArrayRef 2 a [(() (ConstantInteger 3 (Integer 4 [])) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))])) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 b) (FuncCall 2 sum () [(Var 2 a)] [] (Real 4 []))) (If (Compare (FuncCall 2 abs () [(BinOp (Var 2 b) Sub (ImplicitCast (ConstantInteger 6 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))] [] (Real 4 [])) Gt (ConstantReal "1e-5" (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] [])]), size: (Function (SymbolTable 5 {size: (Variable 5 size ReturnVar () Default (Integer 4 []) Source Public)}) size [] [] (Var 5 size) Source Public)}) []) +(TranslationUnit (SymbolTable 1 {arrays_04: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))]) Source Public), abs: (Function (SymbolTable 4 {a: (Variable 4 a In () Default (Real 4 []) Source Public), r: (Variable 4 r ReturnVar () Default (Real 4 []) Source Public)}) abs [(Var 4 a)] [(Print () [(Str "abs" (Character 8 []))]) (If (Compare (Var 4 a) Gt (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToReal (Real 4 [])) (Logical 4 [])) [(= (Var 4 r) (Var 4 a))] [(= (Var 4 r) (UnaryOp USub (Var 4 a) (Real 4 [])))])] (Var 4 r) Source Public), b: (Variable 2 b Local () Default (Real 4 []) Source Public), sum: (Function (SymbolTable 3 {a: (Variable 3 a In () Default (Real 4 [(() ())]) Source Public), i: (Variable 3 i Local () Default (Integer 4 []) Source Public), r: (Variable 3 r ReturnVar () Default (Real 4 []) Source Public)}) sum [(Var 3 a)] [(Print () [(Str "sum" (Character 8 []))]) (= (Var 3 r) (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToReal (Real 4 []))) (DoLoop ((Var 3 i) (ConstantInteger 1 (Integer 4 [])) (FunctionCall 1 size () [(Var 3 a)] [] (Integer 4 [])) ()) [(= (Var 3 r) (BinOp (Var 3 r) Add (ArrayRef 3 a [(() (Var 3 i) ())] (Real 4 [(() ())])) (Real 4 [])))])] (Var 3 r) Source Public)}) arrays_04 [] [(= (ArrayRef 2 a [(() (ConstantInteger 1 (Integer 4 [])) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))])) (ConstantInteger 3 (Integer 4 []))) (= (ArrayRef 2 a [(() (ConstantInteger 2 (Integer 4 [])) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))])) (ConstantInteger 2 (Integer 4 []))) (= (ArrayRef 2 a [(() (ConstantInteger 3 (Integer 4 [])) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])))])) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 b) (FunctionCall 2 sum () [(Var 2 a)] [] (Real 4 []))) (If (Compare (FunctionCall 2 abs () [(BinOp (Var 2 b) Sub (ImplicitCast (ConstantInteger 6 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))] [] (Real 4 [])) Gt (ConstantReal "1e-5" (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] [])]), size: (Function (SymbolTable 5 {size: (Variable 5 size ReturnVar () Default (Integer 4 []) Source Public)}) size [] [] (Var 5 size) Source Public)}) []) diff --git a/tests/reference/asr-associate_01-24b5a9e.stdout b/tests/reference/asr-associate_01-24b5a9e.stdout deleted file mode 100644 index 99181fedac..0000000000 --- a/tests/reference/asr-associate_01-24b5a9e.stdout +++ /dev/null @@ -1 +0,0 @@ -(TranslationUnit (SymbolTable 1 {associate_01: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [(() ())]) Source Public), a_1: (Variable 2 a_1 Local () Default (Real 4 []) Source Public), b: (Variable 2 b Local () Default (Real 4 [(() ()) (() ())]) Source Public), c: (Variable 2 c Local () Default (Real 4 [(() ()) (() ()) (() ())]) Source Public), c_234: (Variable 2 c_234 Local () Default (Real 4 []) Source Public), n: (Variable 2 n Local () Default (Integer 4 []) Source Public), x: (Variable 2 x Local () Default (RealPointer 4 [(() ())]) Source Public), y: (Variable 2 y Local () Default (RealPointer 4 [(() ()) (() ()) (() ())]) Source Public)}) associate_01 [(= (Var 2 n) (ConstantInteger 10 (Integer 4 []))) (Print () []) (Print () []) (Print () []) (= (Var 2 a_1) (ArrayRef 2 a [(() (ConstantInteger 1 (Integer 4 [])) ())] (Real 4 [(() ())]))) (= (Var 2 c_234) (ArrayRef 2 c [(() (ConstantInteger 2 (Integer 4 [])) ()) (() (ConstantInteger 3 (Integer 4 [])) ()) (() (ConstantInteger 4 (Integer 4 [])) ())] (Real 4 [(() ()) (() ()) (() ())]))) (Print () [(Var 2 a_1)]) (Print () [(Var 2 c_234)])])}) []) diff --git a/tests/reference/asr-associate_02-ca5c9ec.json b/tests/reference/asr-associate_02-ca5c9ec.json index 11fdcce003..040355ffad 100644 --- a/tests/reference/asr-associate_02-ca5c9ec.json +++ b/tests/reference/asr-associate_02-ca5c9ec.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-associate_02-ca5c9ec.stdout", - "stdout_hash": "d43926dec25c398de465e44e7f3de5624eb5d7d0c541d30540ec65b6", + "stdout_hash": "4cf72e5c646f371d4b209a22eb5048d7484926aa62b253494ea56464", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-associate_02-ca5c9ec.stdout b/tests/reference/asr-associate_02-ca5c9ec.stdout index 9a3406e733..086032a6cb 100644 --- a/tests/reference/asr-associate_02-ca5c9ec.stdout +++ b/tests/reference/asr-associate_02-ca5c9ec.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {associate_02: (Program (SymbolTable 2 {p1: (Variable 2 p1 Local () Default (IntegerPointer 4 []) Source Public), p2: (Variable 2 p2 Local () Default (RealPointer 8 []) Source Public), t1: (Variable 2 t1 Local (ConstantInteger 2 (Integer 4 [])) Default (Integer 4 []) Source Public), t2: (Variable 2 t2 Local (ConstantReal "2.0_8" (Real 8 [])) Default (Real 8 []) Source Public)}) associate_02 [(=> (Var 2 p1) (Var 2 t1)) (=> (Var 2 p2) (Var 2 t2)) (= (Var 2 p1) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 p2) (ImplicitCast (ConstantReal "4.0_4" (Real 4 [])) RealToReal (RealPointer 8 []))) (Print () [(Var 2 p1)]) (Print () [(Var 2 t1)]) (= (Var 2 t1) (ImplicitCast (BinOp (Var 2 p2) Add (ImplicitCast (Var 2 p1) IntegerToReal (RealPointer 8 [])) (RealPointer 8 [])) RealToInteger (Integer 4 []))) (Print () [(Var 2 p1)]) (Print () [(Var 2 t1)]) (= (Var 2 t1) (ConstantInteger 8 (Integer 4 []))) (Print () [(Var 2 p1)]) (Print () [(Var 2 t1)])])}) []) +(TranslationUnit (SymbolTable 1 {associate_02: (Program (SymbolTable 2 {p1: (Variable 2 p1 Local () Default (IntegerPointer 4 []) Source Public), p2: (Variable 2 p2 Local () Default (RealPointer 8 []) Source Public), t1: (Variable 2 t1 Local (ConstantInteger 2 (Integer 4 [])) Default (Integer 4 []) Source Public), t2: (Variable 2 t2 Local (ConstantReal "2.0_8" (Real 8 [])) Default (Real 8 []) Source Public)}) associate_02 [] [(=> (Var 2 p1) (Var 2 t1)) (=> (Var 2 p2) (Var 2 t2)) (= (Var 2 p1) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 p2) (ImplicitCast (ConstantReal "4.0_4" (Real 4 [])) RealToReal (RealPointer 8 []))) (Print () [(Var 2 p1)]) (Print () [(Var 2 t1)]) (= (Var 2 t1) (ImplicitCast (BinOp (Var 2 p2) Add (ImplicitCast (Var 2 p1) IntegerToReal (RealPointer 8 [])) (RealPointer 8 [])) RealToInteger (Integer 4 []))) (Print () [(Var 2 p1)]) (Print () [(Var 2 t1)]) (= (Var 2 t1) (ConstantInteger 8 (Integer 4 []))) (Print () [(Var 2 p1)]) (Print () [(Var 2 t1)])])}) []) diff --git a/tests/reference/asr-associate_03-bc2b027.json b/tests/reference/asr-associate_03-bc2b027.json index 9dfbab1b74..79ba8eb307 100644 --- a/tests/reference/asr-associate_03-bc2b027.json +++ b/tests/reference/asr-associate_03-bc2b027.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-associate_03-bc2b027.stdout", - "stdout_hash": "089f2620077f36bfb05a4898eb683fd2525eaaa446ded6757b74d3de", + "stdout_hash": "3b8c43d89cdcb6c5d6a3433720540da6aa5de55dc17fb4538f295317", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-associate_03-bc2b027.stdout b/tests/reference/asr-associate_03-bc2b027.stdout index aa4d7b116c..384e4151ce 100644 --- a/tests/reference/asr-associate_03-bc2b027.stdout +++ b/tests/reference/asr-associate_03-bc2b027.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {associate_03: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), p1: (Variable 2 p1 Local () Default (IntegerPointer 4 []) Source Public), t1: (Variable 2 t1 Local (ConstantInteger 2 (Integer 4 [])) Default (Integer 4 []) Source Public), t2: (Variable 2 t2 Local (ConstantInteger 1 (Integer 4 [])) Default (Integer 4 []) Source Public)}) associate_03 [(Print () [(Var 2 t1) (Var 2 t2)]) (If (Compare (Var 2 t1) Gt (Var 2 t2) (Logical 4 [])) [(=> (Var 2 p1) (Var 2 t1))] [(=> (Var 2 p1) (Var 2 t2))]) (Print () [(Var 2 p1)]) (= (Var 2 i) (Var 2 p1)) (If (Compare (Var 2 i) Eq (Var 2 t2) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {associate_03: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), p1: (Variable 2 p1 Local () Default (IntegerPointer 4 []) Source Public), t1: (Variable 2 t1 Local (ConstantInteger 2 (Integer 4 [])) Default (Integer 4 []) Source Public), t2: (Variable 2 t2 Local (ConstantInteger 1 (Integer 4 [])) Default (Integer 4 []) Source Public)}) associate_03 [] [(Print () [(Var 2 t1) (Var 2 t2)]) (If (Compare (Var 2 t1) Gt (Var 2 t2) (Logical 4 [])) [(=> (Var 2 p1) (Var 2 t1))] [(=> (Var 2 p1) (Var 2 t2))]) (Print () [(Var 2 p1)]) (= (Var 2 i) (Var 2 p1)) (If (Compare (Var 2 i) Eq (Var 2 t2) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/asr-bin_op_complex_dp-26e149c.json b/tests/reference/asr-bin_op_complex_dp-26e149c.json new file mode 100644 index 0000000000..3000055103 --- /dev/null +++ b/tests/reference/asr-bin_op_complex_dp-26e149c.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-bin_op_complex_dp-26e149c", + "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/../integration_tests/bin_op_complex_dp.f90", + "infile_hash": "9be1b396941b73e1466a46963ee3ade085440ce077b444ce7e2f6baf", + "outfile": null, + "outfile_hash": null, + "stdout": "asr-bin_op_complex_dp-26e149c.stdout", + "stdout_hash": "f56db4b84c1e683b90057388ea15ded568a1ef6d58d14d5997e2514b", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/asr-bin_op_complex_dp-26e149c.stdout b/tests/reference/asr-bin_op_complex_dp-26e149c.stdout new file mode 100644 index 0000000000..e18795d914 --- /dev/null +++ b/tests/reference/asr-bin_op_complex_dp-26e149c.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {bin_op_complex_dp: (Program (SymbolTable 2 {u: (Variable 2 u Local () Default (Complex 8 []) Source Public), v: (Variable 2 v Local () Default (Complex 8 []) Source Public), x: (Variable 2 x Local () Default (Complex 4 []) Source Public), zero: (Variable 2 zero Local () Default (Complex 4 []) Source Public)}) bin_op_complex_dp [] [(= (Var 2 zero) (ImplicitCast (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToComplex (Complex 4 []))) (= (Var 2 u) (ImplicitCast (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToComplex (Complex 8 []))) (= (Var 2 v) (ImplicitCast (BinOp (ConstantReal "1.0_8" (Real 8 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 8 [])) (Real 8 [])) RealToComplex (Complex 8 []))) (= (Var 2 x) (ImplicitCast (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToComplex (Complex 4 []))) (Print () [(Var 2 zero) (Var 2 v) (Var 2 x) (Var 2 u)])])}) []) diff --git a/tests/reference/asr-bin_op_real_dp-21bb7e8.json b/tests/reference/asr-bin_op_real_dp-21bb7e8.json index 361069ca4f..68c6ce7bce 100644 --- a/tests/reference/asr-bin_op_real_dp-21bb7e8.json +++ b/tests/reference/asr-bin_op_real_dp-21bb7e8.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-bin_op_real_dp-21bb7e8.stdout", - "stdout_hash": "c8bfbc23a2afecbd5ab938cd371ace098a74ce15aefaff04c151f239", + "stdout_hash": "a9c6351cba88851b25f7767cc73b79b20c6ba8a0c1310d578cafdaa4", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-bin_op_real_dp-21bb7e8.stdout b/tests/reference/asr-bin_op_real_dp-21bb7e8.stdout index 273b6357d3..27d1cddd26 100644 --- a/tests/reference/asr-bin_op_real_dp-21bb7e8.stdout +++ b/tests/reference/asr-bin_op_real_dp-21bb7e8.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {bin_op_real_dp: (Program (SymbolTable 2 {u: (Variable 2 u Local () Default (Real 8 []) Source Public), v: (Variable 2 v Local () Default (Real 8 []) Source Public), x: (Variable 2 x Local () Default (Real 4 []) Source Public), zero: (Variable 2 zero Local () Default (Real 4 []) Source Public)}) bin_op_real_dp [(= (Var 2 zero) (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 u) (ImplicitCast (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToReal (Real 8 []))) (= (Var 2 v) (BinOp (ConstantReal "1.0_8" (Real 8 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 8 [])) (Real 8 []))) (= (Var 2 x) (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))) (Print () [(Var 2 zero) (Var 2 v) (Var 2 x) (Var 2 u)])])}) []) +(TranslationUnit (SymbolTable 1 {bin_op_real_dp: (Program (SymbolTable 2 {u: (Variable 2 u Local () Default (Real 8 []) Source Public), v: (Variable 2 v Local () Default (Real 8 []) Source Public), x: (Variable 2 x Local () Default (Real 4 []) Source Public), zero: (Variable 2 zero Local () Default (Real 4 []) Source Public)}) bin_op_real_dp [] [(= (Var 2 zero) (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 u) (ImplicitCast (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToReal (Real 8 []))) (= (Var 2 v) (BinOp (ConstantReal "1.0_8" (Real 8 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 8 [])) (Real 8 []))) (= (Var 2 x) (BinOp (ConstantReal "1.0_4" (Real 4 [])) Div (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))) (Print () [(Var 2 zero) (Var 2 v) (Var 2 x) (Var 2 u)])])}) []) diff --git a/tests/reference/asr-case_01-b59db9c.json b/tests/reference/asr-case_01-b59db9c.json index 32973d801f..73ba51d5dd 100644 --- a/tests/reference/asr-case_01-b59db9c.json +++ b/tests/reference/asr-case_01-b59db9c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-case_01-b59db9c.stdout", - "stdout_hash": "92ace3f44ae8e267cfeb65d03b3bf107a42b733c9c84e09b6c93be36", + "stdout_hash": "ee4e2180182f32848376d7c270c91cfc0a6d0e9f6b2aadab4a32e50d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-case_01-b59db9c.stdout b/tests/reference/asr-case_01-b59db9c.stdout index 4ff02ca3ec..6b9664683a 100644 --- a/tests/reference/asr-case_01-b59db9c.stdout +++ b/tests/reference/asr-case_01-b59db9c.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {case_01: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public)}) case_01 [(= (Var 2 i) (ConstantInteger 4 (Integer 4 []))) (Select (Var 2 i) [(CaseStmt [(ConstantInteger 1 (Integer 4 []))] [(Print () [(Str "1" (Character 8 []))])]) (CaseStmt [(ConstantInteger 2 (Integer 4 []))] [(Print () [(Str "2" (Character 8 []))])]) (CaseStmt [(ConstantInteger 3 (Integer 4 []))] [(Print () [(Str "3" (Character 8 []))])]) (CaseStmt [(ConstantInteger 4 (Integer 4 []))] [(Print () [(Str "4" (Character 8 []))])])] []) (Select (Var 2 i) [(CaseStmt [(ConstantInteger 1 (Integer 4 []))] [(Print () [(Str "1" (Character 8 []))])]) (CaseStmt [(ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [(Print () [(Str "2,3,4" (Character 8 []))])])] [])])}) []) +(TranslationUnit (SymbolTable 1 {case_01: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public)}) case_01 [] [(= (Var 2 i) (ConstantInteger 4 (Integer 4 []))) (Select (Var 2 i) [(CaseStmt [(ConstantInteger 1 (Integer 4 []))] [(Print () [(Str "1" (Character 8 []))])]) (CaseStmt [(ConstantInteger 2 (Integer 4 []))] [(Print () [(Str "2" (Character 8 []))])]) (CaseStmt [(ConstantInteger 3 (Integer 4 []))] [(Print () [(Str "3" (Character 8 []))])]) (CaseStmt [(ConstantInteger 4 (Integer 4 []))] [(Print () [(Str "4" (Character 8 []))])])] []) (Select (Var 2 i) [(CaseStmt [(ConstantInteger 1 (Integer 4 []))] [(Print () [(Str "1" (Character 8 []))])]) (CaseStmt [(ConstantInteger 2 (Integer 4 [])) (ConstantInteger 3 (Integer 4 [])) (ConstantInteger 4 (Integer 4 []))] [(Print () [(Str "2,3,4" (Character 8 []))])])] [])])}) []) diff --git a/tests/reference/asr-case_02-8557909.json b/tests/reference/asr-case_02-8557909.json index 5e30c971b9..6d667ab98e 100644 --- a/tests/reference/asr-case_02-8557909.json +++ b/tests/reference/asr-case_02-8557909.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-case_02-8557909.stdout", - "stdout_hash": "c92d4e06416058b228e358cc97d5c7869cdce73a8a4927d3c755bf32", + "stdout_hash": "b722c46d498ff60ce23bf7376fdecbaaab8295140809b549459e8245", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-case_02-8557909.stdout b/tests/reference/asr-case_02-8557909.stdout index 672ea5002a..c2b98b314c 100644 --- a/tests/reference/asr-case_02-8557909.stdout +++ b/tests/reference/asr-case_02-8557909.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {case_02: (Program (SymbolTable 2 {marks: (Variable 2 marks Local () Default (Integer 4 []) Source Public)}) case_02 [(= (Var 2 marks) (ConstantInteger 81 (Integer 4 []))) (Select (Var 2 marks) [(CaseStmt_Range (ConstantInteger 91 (Integer 4 [])) (ConstantInteger 100 (Integer 4 [])) [(Print () [(Str "Excellent!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 81 (Integer 4 [])) (ConstantInteger 90 (Integer 4 [])) [(Print () [(Str "Very good!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 71 (Integer 4 [])) (ConstantInteger 80 (Integer 4 [])) [(Print () [(Str "Well done!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 61 (Integer 4 [])) (ConstantInteger 70 (Integer 4 [])) [(Print () [(Str "Not bad!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 41 (Integer 4 [])) (ConstantInteger 60 (Integer 4 [])) [(Print () [(Str "You passed!" (Character 8 []))])]) (CaseStmt_Range () (ConstantInteger 40 (Integer 4 [])) [(Print () [(Str "Better try again!" (Character 8 []))])])] [(Print () [(Str "Invalid marks" (Character 8 []))])]) (Print () [(Str "Your marks are " (Character 8 [])) (Var 2 marks)])])}) []) +(TranslationUnit (SymbolTable 1 {case_02: (Program (SymbolTable 2 {marks: (Variable 2 marks Local () Default (Integer 4 []) Source Public)}) case_02 [] [(= (Var 2 marks) (ConstantInteger 81 (Integer 4 []))) (Select (Var 2 marks) [(CaseStmt_Range (ConstantInteger 91 (Integer 4 [])) (ConstantInteger 100 (Integer 4 [])) [(Print () [(Str "Excellent!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 81 (Integer 4 [])) (ConstantInteger 90 (Integer 4 [])) [(Print () [(Str "Very good!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 71 (Integer 4 [])) (ConstantInteger 80 (Integer 4 [])) [(Print () [(Str "Well done!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 61 (Integer 4 [])) (ConstantInteger 70 (Integer 4 [])) [(Print () [(Str "Not bad!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 41 (Integer 4 [])) (ConstantInteger 60 (Integer 4 [])) [(Print () [(Str "You passed!" (Character 8 []))])]) (CaseStmt_Range () (ConstantInteger 40 (Integer 4 [])) [(Print () [(Str "Better try again!" (Character 8 []))])])] [(Print () [(Str "Invalid marks" (Character 8 []))])]) (Print () [(Str "Your marks are " (Character 8 [])) (Var 2 marks)])])}) []) diff --git a/tests/reference/asr-case_03-e03f722.json b/tests/reference/asr-case_03-e03f722.json index 3fa709b8c0..afaad93bf2 100644 --- a/tests/reference/asr-case_03-e03f722.json +++ b/tests/reference/asr-case_03-e03f722.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-case_03-e03f722.stdout", - "stdout_hash": "0dfe66644edba19f3414873f3c8850005525a2d9ad0ced0e59ed417d", + "stdout_hash": "0726de04843944f4534c9778c571c7514c5182d784fe04e8b37c541c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-case_03-e03f722.stdout b/tests/reference/asr-case_03-e03f722.stdout index 67621a957d..238242dc10 100644 --- a/tests/reference/asr-case_03-e03f722.stdout +++ b/tests/reference/asr-case_03-e03f722.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {case03: (Program (SymbolTable 2 {a: (Variable 2 a Local (ConstantInteger 1 (Integer 4 [])) Parameter (Integer 4 []) Source Public), b: (Variable 2 b Local (ConstantInteger 2 (Integer 4 [])) Parameter (Integer 4 []) Source Public), marks: (Variable 2 marks Local () Default (Integer 4 []) Source Public)}) case03 [(= (Var 2 marks) (ConstantInteger 94 (Integer 4 []))) (Select (Var 2 marks) [(CaseStmt_Range (BinOp (ConstantInteger 40 (Integer 4 [])) Add (Var 2 b) (Integer 4 [])) () [(Print () [(Str "Pass!" (Character 8 []))])]) (CaseStmt_Range () (BinOp (ConstantInteger 39 (Integer 4 [])) Sub (Var 2 a) (Integer 4 [])) [(Print () [(Str "Failed!" (Character 8 []))])])] [(Print () [(Str "Invalid marks" (Character 8 []))])]) (Print () [(Str "Your marks are " (Character 8 [])) (Var 2 marks)]) (= (Var 2 marks) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (Select (Var 2 marks) [(CaseStmt_Range (BinOp (ConstantInteger 40 (Integer 4 [])) Add (Var 2 b) (Integer 4 [])) () [(Print () [(Str "Pass!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 0 (Integer 4 [])) (BinOp (ConstantInteger 39 (Integer 4 [])) Sub (Var 2 a) (Integer 4 [])) [(Print () [(Str "Failed!" (Character 8 []))])])] [(Print () [(Str "Invalid marks" (Character 8 []))])]) (Print () [(Str "Your marks are " (Character 8 [])) (Var 2 marks)])])}) []) +(TranslationUnit (SymbolTable 1 {case03: (Program (SymbolTable 2 {a: (Variable 2 a Local (ConstantInteger 1 (Integer 4 [])) Parameter (Integer 4 []) Source Public), b: (Variable 2 b Local (ConstantInteger 2 (Integer 4 [])) Parameter (Integer 4 []) Source Public), marks: (Variable 2 marks Local () Default (Integer 4 []) Source Public)}) case03 [] [(= (Var 2 marks) (ConstantInteger 94 (Integer 4 []))) (Select (Var 2 marks) [(CaseStmt_Range (BinOp (ConstantInteger 40 (Integer 4 [])) Add (Var 2 b) (Integer 4 [])) () [(Print () [(Str "Pass!" (Character 8 []))])]) (CaseStmt_Range () (BinOp (ConstantInteger 39 (Integer 4 [])) Sub (Var 2 a) (Integer 4 [])) [(Print () [(Str "Failed!" (Character 8 []))])])] [(Print () [(Str "Invalid marks" (Character 8 []))])]) (Print () [(Str "Your marks are " (Character 8 [])) (Var 2 marks)]) (= (Var 2 marks) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (Select (Var 2 marks) [(CaseStmt_Range (BinOp (ConstantInteger 40 (Integer 4 [])) Add (Var 2 b) (Integer 4 [])) () [(Print () [(Str "Pass!" (Character 8 []))])]) (CaseStmt_Range (ConstantInteger 0 (Integer 4 [])) (BinOp (ConstantInteger 39 (Integer 4 [])) Sub (Var 2 a) (Integer 4 [])) [(Print () [(Str "Failed!" (Character 8 []))])])] [(Print () [(Str "Invalid marks" (Character 8 []))])]) (Print () [(Str "Your marks are " (Character 8 [])) (Var 2 marks)])])}) []) diff --git a/tests/reference/asr-complex1-322879a.json b/tests/reference/asr-complex1-322879a.json index 701cb4054e..5b10135aef 100644 --- a/tests/reference/asr-complex1-322879a.json +++ b/tests/reference/asr-complex1-322879a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex1-322879a.stdout", - "stdout_hash": "4ddfca81648f9ee335d12e8cc6a5125afa9c2365c64978c96da4e336", + "stdout_hash": "360282bcb8ce1a65f3b7b47e75d832011482a3dc2067b9ae446c7184", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex1-322879a.stdout b/tests/reference/asr-complex1-322879a.stdout index 2372b1acff..cb5a3b0e86 100644 --- a/tests/reference/asr-complex1-322879a.stdout +++ b/tests/reference/asr-complex1-322879a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex1: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex1 [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 [])))])}) []) +(TranslationUnit (SymbolTable 1 {complex1: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex1 [] [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 [])))])}) []) diff --git a/tests/reference/asr-complex2-5384cb2.json b/tests/reference/asr-complex2-5384cb2.json index 8a2d1aede3..7848a3b514 100644 --- a/tests/reference/asr-complex2-5384cb2.json +++ b/tests/reference/asr-complex2-5384cb2.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex2-5384cb2.stdout", - "stdout_hash": "3a89c63520702ea6fd577205d27ecdd50865be523b80368c20e48178", + "stdout_hash": "ecefb3c41a03b8ac5205e7a5ff404e14b55284748352c2e89e492dd8", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex2-5384cb2.stdout b/tests/reference/asr-complex2-5384cb2.stdout index 56024ca8da..00a502f24a 100644 --- a/tests/reference/asr-complex2-5384cb2.stdout +++ b/tests/reference/asr-complex2-5384cb2.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex2 [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (Var 2 x) Add (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantReal "2.0" (Real 4 [])) RealToComplex (Complex 4 [])) Add (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (BinOp (ImplicitCast (ConstantReal "2.0" (Real 4 [])) RealToComplex (Complex 4 [])) Add (Var 2 x) (Complex 4 [])) Add (ConstantComplex (ConstantReal "0.0" (Real 4 [])) (ConstantReal "3.0" (Real 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)])])}) []) +(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex2 [] [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (Var 2 x) Add (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantReal "2.0" (Real 4 [])) RealToComplex (Complex 4 [])) Add (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (BinOp (ImplicitCast (ConstantReal "2.0" (Real 4 [])) RealToComplex (Complex 4 [])) Add (Var 2 x) (Complex 4 [])) Add (ConstantComplex (ConstantReal "0.0" (Real 4 [])) (ConstantReal "3.0" (Real 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)])])}) []) diff --git a/tests/reference/asr-complex_02-af31c89.json b/tests/reference/asr-complex_02-af31c89.json index 254b1503ea..09ccbcdb07 100644 --- a/tests/reference/asr-complex_02-af31c89.json +++ b/tests/reference/asr-complex_02-af31c89.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex_02-af31c89.stdout", - "stdout_hash": "6839ba425cdcf6dae78d40d63840984258a3457ec8bde90d4d4ee29d", + "stdout_hash": "2192c782cb61113313078e4ef7a8b0f494defb8cf85ae6abb79083d8", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex_02-af31c89.stdout b/tests/reference/asr-complex_02-af31c89.stdout index 504f1b4418..bccf82f5b0 100644 --- a/tests/reference/asr-complex_02-af31c89.stdout +++ b/tests/reference/asr-complex_02-af31c89.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex_02: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 []) Source Public), b: (Variable 2 b Local () Default (Real 4 []) Source Public), i_: (Variable 2 i_ Local () Default (Complex 4 []) Source Public), w: (Variable 2 w Local () Default (Complex 4 []) Source Public), x: (Variable 2 x Local () Default (Complex 4 []) Source Public), z: (Variable 2 z Local () Default (Complex 4 []) Source Public)}) complex_02 [(= (Var 2 x) (ConstantComplex (ConstantReal "1.0" (Real 4 [])) (UnaryOp USub (ConstantReal "3.0" (Real 4 [])) (Real 4 [])) (Complex 4 []))) (= (Var 2 a) (ConstantReal "3.0" (Real 4 []))) (= (Var 2 b) (ConstantReal "4.0" (Real 4 []))) (= (Var 2 i_) (ConstantComplex (ConstantInteger 0 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (Complex 4 []))) (= (Var 2 z) (BinOp (ImplicitCast (Var 2 a) RealToComplex (Complex 4 [])) Add (BinOp (Var 2 i_) Mul (ImplicitCast (Var 2 b) RealToComplex (Complex 4 [])) (Complex 4 [])) (Complex 4 []))) (= (Var 2 w) (BinOp (ImplicitCast (BinOp (Var 2 a) Add (Var 2 b) (Real 4 [])) RealToComplex (Complex 4 [])) Add (BinOp (Var 2 i_) Mul (ImplicitCast (BinOp (Var 2 a) Sub (Var 2 b) (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x) (Var 2 z) (Var 2 w)])])}) []) +(TranslationUnit (SymbolTable 1 {complex_02: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 []) Source Public), b: (Variable 2 b Local () Default (Real 4 []) Source Public), i_: (Variable 2 i_ Local () Default (Complex 4 []) Source Public), w: (Variable 2 w Local () Default (Complex 4 []) Source Public), x: (Variable 2 x Local () Default (Complex 4 []) Source Public), z: (Variable 2 z Local () Default (Complex 4 []) Source Public)}) complex_02 [] [(= (Var 2 x) (ConstantComplex (ConstantReal "1.0" (Real 4 [])) (UnaryOp USub (ConstantReal "3.0" (Real 4 [])) (Real 4 [])) (Complex 4 []))) (= (Var 2 a) (ConstantReal "3.0" (Real 4 []))) (= (Var 2 b) (ConstantReal "4.0" (Real 4 []))) (= (Var 2 i_) (ConstantComplex (ConstantInteger 0 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (Complex 4 []))) (= (Var 2 z) (BinOp (ImplicitCast (Var 2 a) RealToComplex (Complex 4 [])) Add (BinOp (Var 2 i_) Mul (ImplicitCast (Var 2 b) RealToComplex (Complex 4 [])) (Complex 4 [])) (Complex 4 []))) (= (Var 2 w) (BinOp (ImplicitCast (BinOp (Var 2 a) Add (Var 2 b) (Real 4 [])) RealToComplex (Complex 4 [])) Add (BinOp (Var 2 i_) Mul (ImplicitCast (BinOp (Var 2 a) Sub (Var 2 b) (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x) (Var 2 z) (Var 2 w)])])}) []) diff --git a/tests/reference/asr-complex_div_test-21dab13.json b/tests/reference/asr-complex_div_test-21dab13.json index c3641c94d1..70878601c9 100644 --- a/tests/reference/asr-complex_div_test-21dab13.json +++ b/tests/reference/asr-complex_div_test-21dab13.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex_div_test-21dab13.stdout", - "stdout_hash": "92377dc0ceb32a11dd893fd514383cc8a6a7c3d38904eb8aab262e69", + "stdout_hash": "38ae58ac0b984ed3d34fe952b45dd7de8515682578f1837233cf2a45", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex_div_test-21dab13.stdout b/tests/reference/asr-complex_div_test-21dab13.stdout index 53423b2a41..790fa3c525 100644 --- a/tests/reference/asr-complex_div_test-21dab13.stdout +++ b/tests/reference/asr-complex_div_test-21dab13.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex2 [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (Var 2 x) Div (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 4 [])) Div (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToComplex (Complex 4 [])) Div (BinOp (Var 2 x) Add (ConstantComplex (ConstantReal "0.0" (Real 4 [])) (ConstantReal "3.0" (Real 4 [])) (Complex 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)])])}) []) +(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex2 [] [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (Var 2 x) Div (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 4 [])) Div (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToComplex (Complex 4 [])) Div (BinOp (Var 2 x) Add (ConstantComplex (ConstantReal "0.0" (Real 4 [])) (ConstantReal "3.0" (Real 4 [])) (Complex 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)])])}) []) diff --git a/tests/reference/asr-complex_dp-ec165b1.json b/tests/reference/asr-complex_dp-ec165b1.json new file mode 100644 index 0000000000..05764b1543 --- /dev/null +++ b/tests/reference/asr-complex_dp-ec165b1.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-complex_dp-ec165b1", + "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/../integration_tests/complex_dp.f90", + "infile_hash": "2ab8a19155ace703dc52c1f26d2ecea0db08a49637452b31871a40b2", + "outfile": null, + "outfile_hash": null, + "stdout": "asr-complex_dp-ec165b1.stdout", + "stdout_hash": "2ce03b8ab62031c8840ce428a01434b94251f66cb6c56651cdc4a145", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/asr-complex_dp-ec165b1.stdout b/tests/reference/asr-complex_dp-ec165b1.stdout new file mode 100644 index 0000000000..c9cd25bae6 --- /dev/null +++ b/tests/reference/asr-complex_dp-ec165b1.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {complex_dp: (Program (SymbolTable 2 {v: (Variable 2 v Local () Default (Complex 8 []) Source Public), x: (Variable 2 x Local () Default (Complex 4 []) Source Public), zero: (Variable 2 zero Local () Default (Complex 4 []) Source Public)}) complex_dp [] [(= (Var 2 zero) (ImplicitCast (ConstantReal "0.0_4" (Real 4 [])) RealToComplex (Complex 4 []))) (= (Var 2 v) (ImplicitCast (ConstantComplex (ConstantReal "1.05_4" (Real 4 [])) (ConstantReal "1.05_4" (Real 4 [])) (Complex 4 [])) ComplexToComplex (Complex 8 []))) (= (Var 2 x) (ImplicitCast (ConstantComplex (ConstantReal "1.05_4" (Real 4 [])) (ConstantReal "1.05_8" (Real 8 [])) (Complex 8 [])) ComplexToComplex (Complex 4 []))) (Print () [(Var 2 v) (Var 2 x) (Var 2 zero)])])}) []) diff --git a/tests/reference/asr-complex_dp_param-b21353f.json b/tests/reference/asr-complex_dp_param-b21353f.json new file mode 100644 index 0000000000..aa38bf1e2a --- /dev/null +++ b/tests/reference/asr-complex_dp_param-b21353f.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-complex_dp_param-b21353f", + "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/../integration_tests/complex_dp_param.f90", + "infile_hash": "0d4d9eaf5bcc2cee6a8b57ee6a66b5a10ced2edf6d64b5d2e2a0bcb8", + "outfile": null, + "outfile_hash": null, + "stdout": "asr-complex_dp_param-b21353f.stdout", + "stdout_hash": "faa707f24d4faa6586972cf2839a8c8476372906f17b5ff31b5e8ba1", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/asr-complex_dp_param-b21353f.stdout b/tests/reference/asr-complex_dp_param-b21353f.stdout new file mode 100644 index 0000000000..ded23806ee --- /dev/null +++ b/tests/reference/asr-complex_dp_param-b21353f.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {complex_dp_param: (Program (SymbolTable 2 {prec1: (Variable 2 prec1 Local (ConstantInteger 4 (Integer 4 [])) Parameter (Integer 4 []) Source Public), prec2: (Variable 2 prec2 Local (ConstantInteger 8 (Integer 4 [])) Parameter (Integer 4 []) Source Public), u: (Variable 2 u Local (ConstantComplex (ConstantReal "1.05" (Real 4 [])) (ConstantReal "1.05" (Real 4 [])) (Complex 4 [])) Default (Complex 4 []) Source Public), v: (Variable 2 v Local (ImplicitCast (ConstantComplex (ConstantReal "1.05" (Real 4 [])) (ConstantReal "1.05_8" (Real 8 [])) (Complex 4 [])) ComplexToComplex (Complex 8 [])) Default (Complex 8 []) Source Public), zero: (Variable 2 zero Local (ImplicitCast (ConstantReal "0.0_4" (Real 4 [])) RealToComplex (Complex 8 [])) Default (Complex 8 []) Source Public)}) complex_dp_param [] [(Print () [(Var 2 u) (Var 2 v) (Var 2 zero)])])}) []) diff --git a/tests/reference/asr-complex_mul_test-562260f.json b/tests/reference/asr-complex_mul_test-562260f.json index eae09e6ef0..0b18b2d926 100644 --- a/tests/reference/asr-complex_mul_test-562260f.json +++ b/tests/reference/asr-complex_mul_test-562260f.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex_mul_test-562260f.stdout", - "stdout_hash": "f6ba7e479ddee13128d4203e73ebf598543e977cc658f90149e2a153", + "stdout_hash": "b576b5a41df54a4f3cd1466b12ac24447822775ec8f2a762748bfe7d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex_mul_test-562260f.stdout b/tests/reference/asr-complex_mul_test-562260f.stdout index 5862ab8307..9e4e8e5a99 100644 --- a/tests/reference/asr-complex_mul_test-562260f.stdout +++ b/tests/reference/asr-complex_mul_test-562260f.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex2 [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (Var 2 x) Mul (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 4 [])) Mul (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (Var 2 x) Mul (ConstantComplex (ConstantReal "0.0" (Real 4 [])) (ConstantReal "3.0" (Real 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)])])}) []) +(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex2 [] [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (Var 2 x) Mul (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 4 [])) Mul (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (Var 2 x) Mul (ConstantComplex (ConstantReal "0.0" (Real 4 [])) (ConstantReal "3.0" (Real 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)])])}) []) diff --git a/tests/reference/asr-complex_pow_test-c556b63.json b/tests/reference/asr-complex_pow_test-c556b63.json index e4a2a7ac36..c18ea0f3ee 100644 --- a/tests/reference/asr-complex_pow_test-c556b63.json +++ b/tests/reference/asr-complex_pow_test-c556b63.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex_pow_test-c556b63.stdout", - "stdout_hash": "44fb47813cc3edd61c47276632b97001cdcdb02448b4bbc2713184d1", + "stdout_hash": "c81dcf835b988411bebab109710eecdd3529df257335eb60b1daabf6", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex_pow_test-c556b63.stdout b/tests/reference/asr-complex_pow_test-c556b63.stdout index 40c85b0929..f6c83abf26 100644 --- a/tests/reference/asr-complex_pow_test-c556b63.stdout +++ b/tests/reference/asr-complex_pow_test-c556b63.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public), y: (Variable 2 y Local () Default (Complex 4 []) Source Public), z: (Variable 2 z Local () Default (Complex 4 []) Source Public)}) complex2 [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 y) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "2.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 z) (BinOp (Var 2 x) Pow (Var 2 y) (Complex 4 []))) (Print () [(Var 2 z)])])}) []) +(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public), y: (Variable 2 y Local () Default (Complex 4 []) Source Public), z: (Variable 2 z Local () Default (Complex 4 []) Source Public)}) complex2 [] [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 y) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "2.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 z) (BinOp (Var 2 x) Pow (Var 2 y) (Complex 4 []))) (Print () [(Var 2 z)])])}) []) diff --git a/tests/reference/asr-complex_sub_test-f54ef56.json b/tests/reference/asr-complex_sub_test-f54ef56.json index 512f00cf27..934d148cfb 100644 --- a/tests/reference/asr-complex_sub_test-f54ef56.json +++ b/tests/reference/asr-complex_sub_test-f54ef56.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-complex_sub_test-f54ef56.stdout", - "stdout_hash": "04e85890899c773cef58a170011d095a80442a10bce851d7bdd2f4de", + "stdout_hash": "1ffbedf7950762fdad67111ec12940dcc1befa24ca1541edcbb3b436", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-complex_sub_test-f54ef56.stdout b/tests/reference/asr-complex_sub_test-f54ef56.stdout index 4a968d48c6..a40ad548ba 100644 --- a/tests/reference/asr-complex_sub_test-f54ef56.stdout +++ b/tests/reference/asr-complex_sub_test-f54ef56.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex2 [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (Var 2 x) Sub (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) Sub (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 4 [])) Sub (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (Var 2 x) Sub (ConstantComplex (ConstantReal "0.0" (Real 4 [])) (ConstantReal "3.0" (Real 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)])])}) []) +(TranslationUnit (SymbolTable 1 {complex2: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Complex 4 []) Source Public)}) complex2 [] [(= (Var 2 x) (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (Var 2 x) Sub (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) (Complex 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (ConstantReal "4.0" (Real 4 [])) RealToComplex (Complex 4 [])) Sub (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToComplex (Complex 4 [])) Sub (Var 2 x) (Complex 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (BinOp (Var 2 x) Sub (ConstantComplex (ConstantReal "0.0" (Real 4 [])) (ConstantReal "3.0" (Real 4 [])) (Complex 4 [])) (Complex 4 []))) (Print () [(Var 2 x)])])}) []) diff --git a/tests/reference/asr-const_real_dp-fa55d4d.json b/tests/reference/asr-const_real_dp-fa55d4d.json index 9abfd8cca7..5e6542fd5c 100644 --- a/tests/reference/asr-const_real_dp-fa55d4d.json +++ b/tests/reference/asr-const_real_dp-fa55d4d.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-const_real_dp-fa55d4d.stdout", - "stdout_hash": "28e783e8f637591aba3f4685562a30c99da06550584b203095578bc2", + "stdout_hash": "755c10bf7aece6816abd0b27d8b1e6b9fcf3a2b75ee79a5c90cd07aa", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-const_real_dp-fa55d4d.stdout b/tests/reference/asr-const_real_dp-fa55d4d.stdout index 80d244df30..1bff12aba6 100644 --- a/tests/reference/asr-const_real_dp-fa55d4d.stdout +++ b/tests/reference/asr-const_real_dp-fa55d4d.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {const_real_dp: (Program (SymbolTable 2 {u: (Variable 2 u Local () Default (Real 8 []) Source Public), v: (Variable 2 v Local () Default (Real 8 []) Source Public), x: (Variable 2 x Local () Default (Real 4 []) Source Public), zero: (Variable 2 zero Local () Default (Real 4 []) Source Public)}) const_real_dp [(= (Var 2 zero) (ConstantReal "0.0_4" (Real 4 []))) (= (Var 2 u) (ImplicitCast (ConstantReal "1.05_4" (Real 4 [])) RealToReal (Real 8 []))) (= (Var 2 v) (ConstantReal "1.05_8" (Real 8 []))) (= (Var 2 x) (ConstantReal "1.05" (Real 4 []))) (Print () [(Var 2 zero) (Var 2 v) (Var 2 x) (Var 2 u)])])}) []) +(TranslationUnit (SymbolTable 1 {const_real_dp: (Program (SymbolTable 2 {u: (Variable 2 u Local () Default (Real 8 []) Source Public), v: (Variable 2 v Local () Default (Real 8 []) Source Public), x: (Variable 2 x Local () Default (Real 4 []) Source Public), zero: (Variable 2 zero Local () Default (Real 4 []) Source Public)}) const_real_dp [] [(= (Var 2 zero) (ConstantReal "0.0_4" (Real 4 []))) (= (Var 2 u) (ImplicitCast (ConstantReal "1.05_4" (Real 4 [])) RealToReal (Real 8 []))) (= (Var 2 v) (ConstantReal "1.05_8" (Real 8 []))) (= (Var 2 x) (ConstantReal "1.05" (Real 4 []))) (Print () [(Var 2 zero) (Var 2 v) (Var 2 x) (Var 2 u)])])}) []) diff --git a/tests/reference/asr-derived_types_03-b1d32aa.json b/tests/reference/asr-derived_types_03-b1d32aa.json index 8bbc74025e..d9ec668dcb 100644 --- a/tests/reference/asr-derived_types_03-b1d32aa.json +++ b/tests/reference/asr-derived_types_03-b1d32aa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-derived_types_03-b1d32aa.stdout", - "stdout_hash": "a7736dc58531bf2eac26b5fc8f9706b90384a269d534e1eb3f7aa656", + "stdout_hash": "ba092946133d02a2582cfb249607632ac282372a37dfefc95ad8bf2a", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-derived_types_03-b1d32aa.stdout b/tests/reference/asr-derived_types_03-b1d32aa.stdout index 861c4b8cb6..25b906f516 100644 --- a/tests/reference/asr-derived_types_03-b1d32aa.stdout +++ b/tests/reference/asr-derived_types_03-b1d32aa.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {derived_types_03: (Program (SymbolTable 2 {X: (DerivedType (SymbolTable 3 {i: (Variable 3 i Local () Default (Integer 4 []) Source Public)}) X Source Public), Y: (Subroutine (SymbolTable 4 {A: (DerivedType (SymbolTable 5 {i: (Variable 5 i Local () Default (Integer 4 []) Source Public)}) A Source Public), b: (Variable 4 b Local () Default (Derived 4 A []) Source Public)}) Y [] [] Source Public), Z: (Function (SymbolTable 6 {A: (DerivedType (SymbolTable 7 {i: (Variable 7 i Local () Default (Integer 4 []) Source Public)}) A Source Public), Z: (Variable 6 Z ReturnVar () Default (Integer 4 []) Source Public), b: (Variable 6 b Local () Default (Derived 6 A []) Source Public)}) Z [] [(= (Var 6 Z) (ConstantInteger 5 (Integer 4 [])))] (Var 6 Z) Source Public), b: (Variable 2 b Local () Default (Derived 2 X []) Source Public)}) derived_types_03 [])}) []) +(TranslationUnit (SymbolTable 1 {derived_types_03: (Program (SymbolTable 2 {X: (DerivedType (SymbolTable 3 {i: (Variable 3 i Local () Default (Integer 4 []) Source Public)}) X Source Public), Y: (Subroutine (SymbolTable 4 {A: (DerivedType (SymbolTable 5 {i: (Variable 5 i Local () Default (Integer 4 []) Source Public)}) A Source Public), b: (Variable 4 b Local () Default (Derived 4 A []) Source Public)}) Y [] [] Source Public), Z: (Function (SymbolTable 6 {A: (DerivedType (SymbolTable 7 {i: (Variable 7 i Local () Default (Integer 4 []) Source Public)}) A Source Public), Z: (Variable 6 Z ReturnVar () Default (Integer 4 []) Source Public), b: (Variable 6 b Local () Default (Derived 6 A []) Source Public)}) Z [] [(= (Var 6 Z) (ConstantInteger 5 (Integer 4 [])))] (Var 6 Z) Source Public), b: (Variable 2 b Local () Default (Derived 2 X []) Source Public)}) derived_types_03 [] [])}) []) diff --git a/tests/reference/asr-doloop_01-5cd8bf1.json b/tests/reference/asr-doloop_01-5cd8bf1.json index 1f7f28e543..365a2e0ab1 100644 --- a/tests/reference/asr-doloop_01-5cd8bf1.json +++ b/tests/reference/asr-doloop_01-5cd8bf1.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-doloop_01-5cd8bf1.stdout", - "stdout_hash": "4ce6b63a737c697ea39c1cf608a648baab074048d137a38ddedcc619", + "stdout_hash": "64fa1b356dccf0e6fda9144f8385db2dfc6a17b7df7664d4d3cef39b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-doloop_01-5cd8bf1.stdout b/tests/reference/asr-doloop_01-5cd8bf1.stdout index 025de1d039..30174aefce 100644 --- a/tests/reference/asr-doloop_01-5cd8bf1.stdout +++ b/tests/reference/asr-doloop_01-5cd8bf1.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {doloop_01: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) doloop_01 [(= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 9 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 9 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 22 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 22 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 [])) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 0 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {doloop_01: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) doloop_01 [] [(= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 9 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 9 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 2 (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 3 (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 22 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 10 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 22 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 0 (Integer 4 [])) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 0 (Integer 4 [])) (ConstantInteger 1 (Integer 4 [])) (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/asr-doloop_02-cc78975.json b/tests/reference/asr-doloop_02-cc78975.json index c63a69cd80..515cd4cc41 100644 --- a/tests/reference/asr-doloop_02-cc78975.json +++ b/tests/reference/asr-doloop_02-cc78975.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-doloop_02-cc78975.stdout", - "stdout_hash": "96cd18e7dfdfd6025efc311b3c9139c7efbc87a8ea6356f3f4f4f777", + "stdout_hash": "1d0a5de8b0bff7f40ad9651896147ff53d12f73e70469d9dead6b8c3", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-doloop_02-cc78975.stdout b/tests/reference/asr-doloop_02-cc78975.stdout index 3d5109d0e9..6a1684b3cd 100644 --- a/tests/reference/asr-doloop_02-cc78975.stdout +++ b/tests/reference/asr-doloop_02-cc78975.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {doloop_02: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Integer 4 []) Source Public), b: (Variable 2 b Local () Default (Integer 4 []) Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) doloop_02 [(= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 a) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 b) (ConstantInteger 10 (Integer 4 []))) (DoLoop ((Var 2 i) (Var 2 a) (Var 2 b) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 a) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(DoLoop ((Var 2 j) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(= (Var 2 a) (BinOp (BinOp (Var 2 a) Add (BinOp (BinOp (Var 2 i) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) Mul (ConstantInteger 10 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) Add (Var 2 j) (Integer 4 [])))])]) (If (Compare (Var 2 a) NotEq (BinOp (BinOp (ConstantInteger 100 (Integer 4 [])) Mul (ConstantInteger 101 (Integer 4 [])) (Integer 4 [])) Div (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 a) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(DoLoop ((Var 2 j) (ConstantInteger 1 (Integer 4 [])) (Var 2 i) ()) [(= (Var 2 a) (BinOp (Var 2 a) Add (Var 2 j) (Integer 4 [])))])]) (If (Compare (Var 2 a) NotEq (ConstantInteger 220 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {doloop_02: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Integer 4 []) Source Public), b: (Variable 2 b Local () Default (Integer 4 []) Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) doloop_02 [] [(= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 a) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 b) (ConstantInteger 10 (Integer 4 []))) (DoLoop ((Var 2 i) (Var 2 a) (Var 2 b) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 a) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(DoLoop ((Var 2 j) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(= (Var 2 a) (BinOp (BinOp (Var 2 a) Add (BinOp (BinOp (Var 2 i) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) Mul (ConstantInteger 10 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) Add (Var 2 j) (Integer 4 [])))])]) (If (Compare (Var 2 a) NotEq (BinOp (BinOp (ConstantInteger 100 (Integer 4 [])) Mul (ConstantInteger 101 (Integer 4 [])) (Integer 4 [])) Div (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 a) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(DoLoop ((Var 2 j) (ConstantInteger 1 (Integer 4 [])) (Var 2 i) ()) [(= (Var 2 a) (BinOp (Var 2 a) Add (Var 2 j) (Integer 4 [])))])]) (If (Compare (Var 2 a) NotEq (ConstantInteger 220 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/asr-doloop_03-9c463c5.json b/tests/reference/asr-doloop_03-9c463c5.json index 9737d7e670..e62e1e585f 100644 --- a/tests/reference/asr-doloop_03-9c463c5.json +++ b/tests/reference/asr-doloop_03-9c463c5.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-doloop_03-9c463c5.stdout", - "stdout_hash": "f4885f652769ebdc4a5ac6bca3aa082733adcba303ecf2f497c200ec", + "stdout_hash": "ef40f9d935a1807c341ae64b066d71a0baf0cee742a1beaa81aedcda", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-doloop_03-9c463c5.stdout b/tests/reference/asr-doloop_03-9c463c5.stdout index f80d76c945..164202bad2 100644 --- a/tests/reference/asr-doloop_03-9c463c5.stdout +++ b/tests/reference/asr-doloop_03-9c463c5.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {doloop_03: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) doloop_03 [(= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 []))) (If (Compare (Var 2 i) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(Exit)] [])]) (If (Compare (Var 2 j) NotEq (ConstantInteger 3 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(If (Compare (Var 2 i) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(Exit)] []) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(If (Compare (Var 2 i) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(Cycle)] []) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 53 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {doloop_03: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) doloop_03 [] [(= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 []))) (If (Compare (Var 2 i) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(Exit)] [])]) (If (Compare (Var 2 j) NotEq (ConstantInteger 3 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(If (Compare (Var 2 i) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(Exit)] []) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (DoLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10 (Integer 4 [])) ()) [(If (Compare (Var 2 i) Eq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(Cycle)] []) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 53 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/asr-expr5-f0a7df6.json b/tests/reference/asr-expr5-f0a7df6.json index a268660ea4..a0692e6a6d 100644 --- a/tests/reference/asr-expr5-f0a7df6.json +++ b/tests/reference/asr-expr5-f0a7df6.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-expr5-f0a7df6.stdout", - "stdout_hash": "37d20a28cf4db800725aa56058837f225aecdac2e86327f700148eac", + "stdout_hash": "e015a93920b7f01c5ceeeb6735cb5140b1f6f55835eafd39675314cf", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-expr5-f0a7df6.stdout b/tests/reference/asr-expr5-f0a7df6.stdout index d2f3904bd7..be9e7cec09 100644 --- a/tests/reference/asr-expr5-f0a7df6.stdout +++ b/tests/reference/asr-expr5-f0a7df6.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {expr_05: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Integer 4 []) Source Public)}) expr_05 [(= (Var 2 x) (BinOp (BinOp (ConstantInteger 2 (Integer 4 [])) Add (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) Mul (ConstantInteger 5 (Integer 4 [])) (Integer 4 []))) (If (Compare (Var 2 x) Eq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {expr_05: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Integer 4 []) Source Public)}) expr_05 [] [(= (Var 2 x) (BinOp (BinOp (ConstantInteger 2 (Integer 4 [])) Add (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) Mul (ConstantInteger 5 (Integer 4 [])) (Integer 4 []))) (If (Compare (Var 2 x) Eq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/asr-global_scope8-67fff8d.json b/tests/reference/asr-global_scope8-67fff8d.json new file mode 100644 index 0000000000..bbb844f0c9 --- /dev/null +++ b/tests/reference/asr-global_scope8-67fff8d.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-global_scope8-67fff8d", + "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/global_scope8.f90", + "infile_hash": "899df30dee274279a699110fb9af2afad0b826c0abc886f9e2460627", + "outfile": null, + "outfile_hash": null, + "stdout": "asr-global_scope8-67fff8d.stdout", + "stdout_hash": "d9b72b9c17ce9bbfb843541b3ce11d9a69c3f0665790d22c11c5afe9", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/asr-global_scope8-67fff8d.stdout b/tests/reference/asr-global_scope8-67fff8d.stdout new file mode 100644 index 0000000000..728239f18f --- /dev/null +++ b/tests/reference/asr-global_scope8-67fff8d.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {x: (Variable 1 x Local () Default (Integer 4 []) Source Public)}) [(= (Var 1 x) (ConstantInteger 6 (Integer 4 []))) (Var 1 x)]) diff --git a/tests/reference/asr-global_scope9-f638dd0.json b/tests/reference/asr-global_scope9-f638dd0.json new file mode 100644 index 0000000000..6332af7347 --- /dev/null +++ b/tests/reference/asr-global_scope9-f638dd0.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-global_scope9-f638dd0", + "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/global_scope9.f90", + "infile_hash": "29e87c62bbe7f9efedd2e3cf348e80153367ecc0369b16de6f4db296", + "outfile": null, + "outfile_hash": null, + "stdout": "asr-global_scope9-f638dd0.stdout", + "stdout_hash": "68a338e2b7c1a3a9de22e7ef1c55aee20f1c97afea506aed4c50b69b", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/asr-global_scope9-f638dd0.stdout b/tests/reference/asr-global_scope9-f638dd0.stdout new file mode 100644 index 0000000000..49ca34e5b4 --- /dev/null +++ b/tests/reference/asr-global_scope9-f638dd0.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {x: (Variable 1 x Local () Default (Integer 8 []) Source Public)}) [(= (Var 1 x) (ImplicitCast (ConstantInteger 6 (Integer 4 [])) IntegerToInteger (Integer 8 []))) (Var 1 x)]) diff --git a/tests/reference/asr-init_values-19dfa76.json b/tests/reference/asr-init_values-19dfa76.json index 53f27bd60b..5b8ecc700b 100644 --- a/tests/reference/asr-init_values-19dfa76.json +++ b/tests/reference/asr-init_values-19dfa76.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-init_values-19dfa76.stdout", - "stdout_hash": "65182ec8cd37d827a0571aebb14c9875f469694623dcd46d56db8961", + "stdout_hash": "95145f4691e6dafea171631fd0ec0d83fb6fb29a0545f4e6aa11cfc9", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-init_values-19dfa76.stdout b/tests/reference/asr-init_values-19dfa76.stdout index 49d5a22bda..51c7e6095d 100644 --- a/tests/reference/asr-init_values-19dfa76.stdout +++ b/tests/reference/asr-init_values-19dfa76.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {init_values: (Program (SymbolTable 2 {c: (Variable 2 c Local (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 [])) Default (Complex 4 []) Source Public), i: (Variable 2 i Local (ImplicitCast (ConstantReal "1.0" (Real 4 [])) RealToInteger (Integer 4 [])) Default (Integer 4 []) Source Public), r: (Variable 2 r Local (ConstantReal "4.0" (Real 4 [])) Default (Real 4 []) Source Public)}) init_values [(Print () [(Var 2 i) (Var 2 r) (Var 2 c)])])}) []) +(TranslationUnit (SymbolTable 1 {init_values: (Program (SymbolTable 2 {c: (Variable 2 c Local (ConstantComplex (ConstantReal "3.0" (Real 4 [])) (ConstantReal "4.0" (Real 4 [])) (Complex 4 [])) Default (Complex 4 []) Source Public), i: (Variable 2 i Local (ImplicitCast (ConstantReal "1.0" (Real 4 [])) RealToInteger (Integer 4 [])) Default (Integer 4 []) Source Public), r: (Variable 2 r Local (ConstantReal "4.0" (Real 4 [])) Default (Real 4 []) Source Public)}) init_values [] [(Print () [(Var 2 i) (Var 2 r) (Var 2 c)])])}) []) diff --git a/tests/reference/asr-int_dp-41a64fa.json b/tests/reference/asr-int_dp-41a64fa.json index 632259e324..cf426987e1 100644 --- a/tests/reference/asr-int_dp-41a64fa.json +++ b/tests/reference/asr-int_dp-41a64fa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-int_dp-41a64fa.stdout", - "stdout_hash": "02574f5a31716b04407d4eb7d334b932b3f40b61da754d286a4ef8b4", + "stdout_hash": "c868761023ca55393df03c6d8bf168a34599ebc823c50f4281229c13", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-int_dp-41a64fa.stdout b/tests/reference/asr-int_dp-41a64fa.stdout index 776c3fc1b2..26ce7fd712 100644 --- a/tests/reference/asr-int_dp-41a64fa.stdout +++ b/tests/reference/asr-int_dp-41a64fa.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {int_dp: (Program (SymbolTable 2 {u: (Variable 2 u Local (ConstantInteger 2147483647 (Integer 4 [])) Default (Integer 4 []) Source Public), v: (Variable 2 v Local (ImplicitCast (ConstantInteger 2147483647 (Integer 4 [])) IntegerToInteger (Integer 8 [])) Default (Integer 8 []) Source Public)}) int_dp [(Print () [(Var 2 u) (Var 2 v)])])}) []) +(TranslationUnit (SymbolTable 1 {int_dp: (Program (SymbolTable 2 {u: (Variable 2 u Local (ConstantInteger 2147483647 (Integer 4 [])) Default (Integer 4 []) Source Public), v: (Variable 2 v Local (ImplicitCast (ConstantInteger 2147483647 (Integer 4 [])) IntegerToInteger (Integer 8 [])) Default (Integer 8 []) Source Public)}) int_dp [] [(Print () [(Var 2 u) (Var 2 v)])])}) []) diff --git a/tests/reference/asr-int_dp_param-19bf015.json b/tests/reference/asr-int_dp_param-19bf015.json index 4d9207b7d6..2e9d23cfa6 100644 --- a/tests/reference/asr-int_dp_param-19bf015.json +++ b/tests/reference/asr-int_dp_param-19bf015.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-int_dp_param-19bf015.stdout", - "stdout_hash": "81296055475943b6cb19b13d7909a13c6af0b566076e7d281af41c75", + "stdout_hash": "5bf89f2cf071af78924e266c563c14e71fb95233d0fff125cba6731f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-int_dp_param-19bf015.stdout b/tests/reference/asr-int_dp_param-19bf015.stdout index 7b20912f39..f8b5a20e0d 100644 --- a/tests/reference/asr-int_dp_param-19bf015.stdout +++ b/tests/reference/asr-int_dp_param-19bf015.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {int_dp_param: (Program (SymbolTable 2 {prec1: (Variable 2 prec1 Local (ConstantInteger 4 (Integer 4 [])) Parameter (Integer 4 []) Source Public), prec2: (Variable 2 prec2 Local (ConstantInteger 8 (Integer 4 [])) Parameter (Integer 4 []) Source Public), u: (Variable 2 u Local (ConstantInteger 2147483647 (Integer 4 [])) Default (Integer 4 []) Source Public), v: (Variable 2 v Local (ImplicitCast (ConstantInteger 2147483647 (Integer 4 [])) IntegerToInteger (Integer 8 [])) Default (Integer 8 []) Source Public)}) int_dp_param [(Print () [(Var 2 u) (Var 2 v)])])}) []) +(TranslationUnit (SymbolTable 1 {int_dp_param: (Program (SymbolTable 2 {prec1: (Variable 2 prec1 Local (ConstantInteger 4 (Integer 4 [])) Parameter (Integer 4 []) Source Public), prec2: (Variable 2 prec2 Local (ConstantInteger 8 (Integer 4 [])) Parameter (Integer 4 []) Source Public), u: (Variable 2 u Local (ConstantInteger 2147483647 (Integer 4 [])) Default (Integer 4 []) Source Public), v: (Variable 2 v Local (ImplicitCast (ConstantInteger 2147483647 (Integer 4 [])) IntegerToInteger (Integer 8 [])) Default (Integer 8 []) Source Public)}) int_dp_param [] [(Print () [(Var 2 u) (Var 2 v)])])}) []) diff --git a/tests/reference/asr-interface_01-9dc98da.json b/tests/reference/asr-interface_01-9dc98da.json index 25e76994fe..6e88cfc393 100644 --- a/tests/reference/asr-interface_01-9dc98da.json +++ b/tests/reference/asr-interface_01-9dc98da.json @@ -2,11 +2,11 @@ "basename": "asr-interface_01-9dc98da", "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/interface_01.f90", - "infile_hash": "fc4522469f3b6ff802e3198f034497a8c7b11b5ec051dc93d62b9ab5", + "infile_hash": "56828a66265782f7acd20520a5d25ac6246d6d44dfb8fa758507ed63", "outfile": null, "outfile_hash": null, "stdout": "asr-interface_01-9dc98da.stdout", - "stdout_hash": "6ce2c55c65403b6755d97a964d2ee87f8f74452230038c4a9a65f500", + "stdout_hash": "1ef41346ae3690aeb69b76ce09059c64eda892845d6b3295fed9f2db", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-interface_01-9dc98da.stdout b/tests/reference/asr-interface_01-9dc98da.stdout index e5b16a828d..3835ff5a07 100644 --- a/tests/reference/asr-interface_01-9dc98da.stdout +++ b/tests/reference/asr-interface_01-9dc98da.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {interface_01: (Program (SymbolTable 5 {a: (ExternalSymbol 5 a 2 a Public), i: (Variable 5 i Local () Default (Integer 4 []) Source Public), r: (Variable 5 r Local () Default (Real 4 []) Source Public)}) interface_01 [(= (Var 5 i) (ConstantInteger 5 (Integer 4 []))) (SubroutineCall 2 a1 5 a [(Var 5 i)]) (If (Compare (Var 5 i) NotEq (ConstantInteger 6 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 5 r) (ImplicitCast (ConstantInteger 6 (Integer 4 [])) IntegerToReal (Real 4 []))) (SubroutineCall 2 a2 5 a [(Var 5 r)]) (If (Compare (Var 5 r) NotEq (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] [])]), interface_01_mod: (Module (SymbolTable 2 {a: (GenericProcedure 2 a [2 a1 2 a2] Public), a1: (Subroutine (SymbolTable 3 {a: (Variable 3 a InOut () Default (Integer 4 []) Source Public)}) a1 [(Var 3 a)] [(= (Var 3 a) (BinOp (Var 3 a) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), a2: (Subroutine (SymbolTable 4 {a: (Variable 4 a InOut () Default (Real 4 []) Source Public)}) a2 [(Var 4 a)] [(= (Var 4 a) (BinOp (Var 4 a) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])))] Source Public)}) interface_01_mod)}) []) +(TranslationUnit (SymbolTable 1 {interface_01: (Program (SymbolTable 5 {a: (ExternalSymbol 5 a 2 a interface_01_mod a Public), a@a1: (ExternalSymbol 5 a@a1 2 a1 interface_01_mod a1 Private), a@a2: (ExternalSymbol 5 a@a2 2 a2 interface_01_mod a2 Private), i: (Variable 5 i Local () Default (Integer 4 []) Source Public), r: (Variable 5 r Local () Default (Real 4 []) Source Public)}) interface_01 [interface_01_mod] [(= (Var 5 i) (ConstantInteger 5 (Integer 4 []))) (SubroutineCall 5 a@a1 5 a [(Var 5 i)]) (If (Compare (Var 5 i) NotEq (ConstantInteger 6 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 5 r) (ImplicitCast (ConstantInteger 6 (Integer 4 [])) IntegerToReal (Real 4 []))) (SubroutineCall 5 a@a2 5 a [(Var 5 r)]) (If (Compare (Var 5 r) NotEq (ImplicitCast (ConstantInteger 7 (Integer 4 [])) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 5 i) (ConstantInteger 7 (Integer 4 []))) (SubroutineCall 5 a@a1 5 a [(Var 5 i)]) (If (Compare (Var 5 i) NotEq (ConstantInteger 8 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])]), interface_01_mod: (Module (SymbolTable 2 {a: (GenericProcedure 2 a [2 a1 2 a2] Public), a1: (Subroutine (SymbolTable 3 {a: (Variable 3 a InOut () Default (Integer 4 []) Source Public)}) a1 [(Var 3 a)] [(= (Var 3 a) (BinOp (Var 3 a) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), a2: (Subroutine (SymbolTable 4 {a: (Variable 4 a InOut () Default (Real 4 []) Source Public)}) a2 [(Var 4 a)] [(= (Var 4 a) (BinOp (Var 4 a) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])))] Source Public)}) interface_01_mod [] .false.)}) []) diff --git a/tests/reference/asr-intrinsics_02-1c20d1a.json b/tests/reference/asr-intrinsics_02-1c20d1a.json index cdc6d06b94..2177a4beab 100644 --- a/tests/reference/asr-intrinsics_02-1c20d1a.json +++ b/tests/reference/asr-intrinsics_02-1c20d1a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-intrinsics_02-1c20d1a.stdout", - "stdout_hash": "488b939dcb1a2742eb2ecf609fa106b44e4e3c8fa28c704a94ce2a50", + "stdout_hash": "342f624036b50c7910bafa63792f2e96dbe8d2d82db69415e55a24a6", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-intrinsics_02-1c20d1a.stdout b/tests/reference/asr-intrinsics_02-1c20d1a.stdout index acc3dc7100..891badd21c 100644 --- a/tests/reference/asr-intrinsics_02-1c20d1a.stdout +++ b/tests/reference/asr-intrinsics_02-1c20d1a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {intrinsics_02: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_02 [(= (Var 2 x) (FuncCall 1 sin () [(ConstantReal "1.5" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])]), sin: (Function (SymbolTable 3 {sin: (Variable 3 sin ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) sin [(Var 3 x)] [] (Var 3 sin) Intrinsic Public)}) []) +(TranslationUnit (SymbolTable 1 {intrinsics_02: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_02 [] [(= (Var 2 x) (FunctionCall 1 sin () [(ConstantReal "1.5" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])]), sin: (Function (SymbolTable 3 {sin: (Variable 3 sin ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) sin [(Var 3 x)] [] (Var 3 sin) Intrinsic Public)}) []) diff --git a/tests/reference/asr-intrinsics_03-ef06d46.json b/tests/reference/asr-intrinsics_03-ef06d46.json index f46aaa2c9f..e35f2e4242 100644 --- a/tests/reference/asr-intrinsics_03-ef06d46.json +++ b/tests/reference/asr-intrinsics_03-ef06d46.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-intrinsics_03-ef06d46.stdout", - "stdout_hash": "4cdb719d556b1b159d708015e658f5341b123259ddbaf0796788fe1b", + "stdout_hash": "22a232535009ce054d7728b5bb1e84849ea6863b2974323b1f117577", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-intrinsics_03-ef06d46.stdout b/tests/reference/asr-intrinsics_03-ef06d46.stdout index e9264b4552..d6146f164b 100644 --- a/tests/reference/asr-intrinsics_03-ef06d46.stdout +++ b/tests/reference/asr-intrinsics_03-ef06d46.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {cos: (Function (SymbolTable 3 {cos: (Variable 3 cos ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) cos [(Var 3 x)] [] (Var 3 cos) Intrinsic Public), intrinsics_03: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_03 [(= (Var 2 x) (FuncCall 1 cos () [(ConstantReal "9.5" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])])}) []) +(TranslationUnit (SymbolTable 1 {cos: (Function (SymbolTable 3 {cos: (Variable 3 cos ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) cos [(Var 3 x)] [] (Var 3 cos) Intrinsic Public), intrinsics_03: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_03 [] [(= (Var 2 x) (FunctionCall 1 cos () [(ConstantReal "9.5" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])])}) []) diff --git a/tests/reference/asr-intrinsics_04-524ec3a.json b/tests/reference/asr-intrinsics_04-524ec3a.json index 66b21c35f6..bd6614705a 100644 --- a/tests/reference/asr-intrinsics_04-524ec3a.json +++ b/tests/reference/asr-intrinsics_04-524ec3a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-intrinsics_04-524ec3a.stdout", - "stdout_hash": "71f18fc85df651d2f18ec6c2e1bd922d9b98e11421a80b30e7da7e8d", + "stdout_hash": "5d8eb418c2fe358442b59cee53e82fbc886aa13fd1b56b1e334a839f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-intrinsics_04-524ec3a.stdout b/tests/reference/asr-intrinsics_04-524ec3a.stdout index 115f8f5ccc..1a136240dd 100644 --- a/tests/reference/asr-intrinsics_04-524ec3a.stdout +++ b/tests/reference/asr-intrinsics_04-524ec3a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {intrinsics_04: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_04 [(= (Var 2 x) (FuncCall 1 tan () [(ConstantReal "1.5" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])]), tan: (Function (SymbolTable 3 {tan: (Variable 3 tan ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) tan [(Var 3 x)] [] (Var 3 tan) Intrinsic Public)}) []) +(TranslationUnit (SymbolTable 1 {intrinsics_04: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_04 [] [(= (Var 2 x) (FunctionCall 1 tan () [(ConstantReal "1.5" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])]), tan: (Function (SymbolTable 3 {tan: (Variable 3 tan ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) tan [(Var 3 x)] [] (Var 3 tan) Intrinsic Public)}) []) diff --git a/tests/reference/asr-intrinsics_05-4c31742.json b/tests/reference/asr-intrinsics_05-4c31742.json index d20d22c3ae..da35715b4c 100644 --- a/tests/reference/asr-intrinsics_05-4c31742.json +++ b/tests/reference/asr-intrinsics_05-4c31742.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-intrinsics_05-4c31742.stdout", - "stdout_hash": "069b8e4d3b8dd52711ba464ef6cdf06b6886fdf2e364954e76f563c8", + "stdout_hash": "137bef9e539787754f5fa77366fd809d9c0bc76ff9dbef716eab197a", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-intrinsics_05-4c31742.stdout b/tests/reference/asr-intrinsics_05-4c31742.stdout index 1d341686fc..631e6b7a5f 100644 --- a/tests/reference/asr-intrinsics_05-4c31742.stdout +++ b/tests/reference/asr-intrinsics_05-4c31742.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {cosh: (Function (SymbolTable 4 {cosh: (Variable 4 cosh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 4 x In () Default (Real 4 []) Source Public)}) cosh [(Var 4 x)] [] (Var 4 cosh) Intrinsic Public), intrinsics_05: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_05 [(= (Var 2 x) (FuncCall 1 sinh () [(ConstantReal "1.0" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FuncCall 1 cosh () [(ConstantReal "1.0" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FuncCall 1 tanh () [(ConstantReal "1.0" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])]), sinh: (Function (SymbolTable 3 {sinh: (Variable 3 sinh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) sinh [(Var 3 x)] [] (Var 3 sinh) Intrinsic Public), tanh: (Function (SymbolTable 5 {tanh: (Variable 5 tanh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 5 x In () Default (Real 4 []) Source Public)}) tanh [(Var 5 x)] [] (Var 5 tanh) Intrinsic Public)}) []) +(TranslationUnit (SymbolTable 1 {cosh: (Function (SymbolTable 4 {cosh: (Variable 4 cosh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 4 x In () Default (Real 4 []) Source Public)}) cosh [(Var 4 x)] [] (Var 4 cosh) Intrinsic Public), intrinsics_05: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_05 [] [(= (Var 2 x) (FunctionCall 1 sinh () [(ConstantReal "1.0" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FunctionCall 1 cosh () [(ConstantReal "1.0" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FunctionCall 1 tanh () [(ConstantReal "1.0" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])]), sinh: (Function (SymbolTable 3 {sinh: (Variable 3 sinh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) sinh [(Var 3 x)] [] (Var 3 sinh) Intrinsic Public), tanh: (Function (SymbolTable 5 {tanh: (Variable 5 tanh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 5 x In () Default (Real 4 []) Source Public)}) tanh [(Var 5 x)] [] (Var 5 tanh) Intrinsic Public)}) []) diff --git a/tests/reference/asr-intrinsics_06-8523892.json b/tests/reference/asr-intrinsics_06-8523892.json index cf50a4593b..3e12a40772 100644 --- a/tests/reference/asr-intrinsics_06-8523892.json +++ b/tests/reference/asr-intrinsics_06-8523892.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-intrinsics_06-8523892.stdout", - "stdout_hash": "1962d7a0880956fa1946bb89e8413550a203760a330f6f0186694a52", + "stdout_hash": "a1d90e83f97e0d16527e57199bcb5f4e1fa0c14a9e02353f14cfbeda", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-intrinsics_06-8523892.stdout b/tests/reference/asr-intrinsics_06-8523892.stdout index 833c14483f..5c5490b5b6 100644 --- a/tests/reference/asr-intrinsics_06-8523892.stdout +++ b/tests/reference/asr-intrinsics_06-8523892.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {acos: (Function (SymbolTable 4 {acos: (Variable 4 acos ReturnVar () Default (Real 4 []) Source Public), x: (Variable 4 x In () Default (Real 4 []) Source Public)}) acos [(Var 4 x)] [] (Var 4 acos) Intrinsic Public), acosh: (Function (SymbolTable 7 {acosh: (Variable 7 acosh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 7 x In () Default (Real 4 []) Source Public)}) acosh [(Var 7 x)] [] (Var 7 acosh) Intrinsic Public), asin: (Function (SymbolTable 3 {asin: (Variable 3 asin ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) asin [(Var 3 x)] [] (Var 3 asin) Intrinsic Public), asinh: (Function (SymbolTable 6 {asinh: (Variable 6 asinh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 6 x In () Default (Real 4 []) Source Public)}) asinh [(Var 6 x)] [] (Var 6 asinh) Intrinsic Public), atan: (Function (SymbolTable 5 {atan: (Variable 5 atan ReturnVar () Default (Real 4 []) Source Public), x: (Variable 5 x In () Default (Real 4 []) Source Public)}) atan [(Var 5 x)] [] (Var 5 atan) Intrinsic Public), atanh: (Function (SymbolTable 8 {atanh: (Variable 8 atanh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 8 x In () Default (Real 4 []) Source Public)}) atanh [(Var 8 x)] [] (Var 8 atanh) Intrinsic Public), intrinsics_06: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_06 [(= (Var 2 x) (FuncCall 1 asin () [(ConstantReal "0.84147098" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FuncCall 1 acos () [(ConstantReal "0.54030231" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FuncCall 1 atan () [(ConstantReal "1.5574077" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FuncCall 1 asinh () [(ConstantReal "1.1752012" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FuncCall 1 acosh () [(ConstantReal "1.5430806" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FuncCall 1 atanh () [(ConstantReal "0.76159416" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])])}) []) +(TranslationUnit (SymbolTable 1 {acos: (Function (SymbolTable 4 {acos: (Variable 4 acos ReturnVar () Default (Real 4 []) Source Public), x: (Variable 4 x In () Default (Real 4 []) Source Public)}) acos [(Var 4 x)] [] (Var 4 acos) Intrinsic Public), acosh: (Function (SymbolTable 7 {acosh: (Variable 7 acosh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 7 x In () Default (Real 4 []) Source Public)}) acosh [(Var 7 x)] [] (Var 7 acosh) Intrinsic Public), asin: (Function (SymbolTable 3 {asin: (Variable 3 asin ReturnVar () Default (Real 4 []) Source Public), x: (Variable 3 x In () Default (Real 4 []) Source Public)}) asin [(Var 3 x)] [] (Var 3 asin) Intrinsic Public), asinh: (Function (SymbolTable 6 {asinh: (Variable 6 asinh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 6 x In () Default (Real 4 []) Source Public)}) asinh [(Var 6 x)] [] (Var 6 asinh) Intrinsic Public), atan: (Function (SymbolTable 5 {atan: (Variable 5 atan ReturnVar () Default (Real 4 []) Source Public), x: (Variable 5 x In () Default (Real 4 []) Source Public)}) atan [(Var 5 x)] [] (Var 5 atan) Intrinsic Public), atanh: (Function (SymbolTable 8 {atanh: (Variable 8 atanh ReturnVar () Default (Real 4 []) Source Public), x: (Variable 8 x In () Default (Real 4 []) Source Public)}) atanh [(Var 8 x)] [] (Var 8 atanh) Intrinsic Public), intrinsics_06: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) intrinsics_06 [] [(= (Var 2 x) (FunctionCall 1 asin () [(ConstantReal "0.84147098" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FunctionCall 1 acos () [(ConstantReal "0.54030231" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FunctionCall 1 atan () [(ConstantReal "1.5574077" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FunctionCall 1 asinh () [(ConstantReal "1.1752012" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FunctionCall 1 acosh () [(ConstantReal "1.5430806" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)]) (= (Var 2 x) (FunctionCall 1 atanh () [(ConstantReal "0.76159416" (Real 4 []))] [] (Real 4 []))) (Print () [(Var 2 x)])])}) []) diff --git a/tests/reference/asr-kokkos_program2-8391215.json b/tests/reference/asr-kokkos_program2-8391215.json index f2a71d400d..e15ce6317f 100644 --- a/tests/reference/asr-kokkos_program2-8391215.json +++ b/tests/reference/asr-kokkos_program2-8391215.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-kokkos_program2-8391215.stdout", - "stdout_hash": "466e7ff1d3a542a041bbc84251f398e7290efa2938548ddbc5b1c592", + "stdout_hash": "e0aeda06cc12fce414dfe24a1c1caea5943d4e93a05fe61b5107a6b0", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-kokkos_program2-8391215.stdout b/tests/reference/asr-kokkos_program2-8391215.stdout index 19f7d788ad..f039539d7a 100644 --- a/tests/reference/asr-kokkos_program2-8391215.stdout +++ b/tests/reference/asr-kokkos_program2-8391215.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {kokkos_program2: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public), b: (Variable 2 b Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public), c: (Variable 2 c Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), nsize: (Variable 2 nsize Local () Default (Integer 4 []) Source Public), scalar: (Variable 2 scalar Local () Default (Real 4 []) Source Public), triad: (Subroutine (SymbolTable 3 {N: (Variable 3 N Local () Default (Integer 4 []) Source Public), a: (Variable 3 a In () Default (Real 4 [(() ())]) Source Public), b: (Variable 3 b In () Default (Real 4 [(() ())]) Source Public), c: (Variable 3 c Out () Default (Real 4 [(() ())]) Source Public), i: (Variable 3 i Local () Default (Integer 4 []) Source Public), scalar: (Variable 3 scalar In () Default (Real 4 []) Source Public)}) triad [(Var 3 a) (Var 3 b) (Var 3 scalar) (Var 3 c)] [(= (Var 3 N) (FuncCall 1 size () [(Var 3 a)] [] (Integer 4 []))) (DoConcurrentLoop ((Var 3 i) (ConstantInteger 1 (Integer 4 [])) (Var 3 N) ()) [(= (ArrayRef 3 c [(() (Var 3 i) ())] (Real 4 [(() ())])) (BinOp (ArrayRef 3 a [(() (Var 3 i) ())] (Real 4 [(() ())])) Add (BinOp (Var 3 scalar) Mul (ArrayRef 3 b [(() (Var 3 i) ())] (Real 4 [(() ())])) (Real 4 [])) (Real 4 [(() ())])))])] Source Public)}) kokkos_program2 [(= (Var 2 scalar) (ImplicitCast (ConstantInteger 10 (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 nsize) (FuncCall 1 size () [(Var 2 a)] [] (Integer 4 []))) (DoConcurrentLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (Var 2 nsize) ()) [(= (ArrayRef 2 a [(() (Var 2 i) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))])) (ConstantInteger 5 (Integer 4 []))) (= (ArrayRef 2 b [(() (Var 2 i) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))])) (ConstantInteger 5 (Integer 4 [])))]) (SubroutineCall 2 triad () [(Var 2 a) (Var 2 b) (Var 2 scalar) (Var 2 c)]) (Print () [(Str "End Stream Triad" (Character 8 []))])]), size: (Function (SymbolTable 4 {size: (Variable 4 size ReturnVar () Default (Integer 4 []) Source Public)}) size [] [] (Var 4 size) Source Public)}) []) +(TranslationUnit (SymbolTable 1 {kokkos_program2: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public), b: (Variable 2 b Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public), c: (Variable 2 c Local () Default (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))]) Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), nsize: (Variable 2 nsize Local () Default (Integer 4 []) Source Public), scalar: (Variable 2 scalar Local () Default (Real 4 []) Source Public), triad: (Subroutine (SymbolTable 3 {N: (Variable 3 N Local () Default (Integer 4 []) Source Public), a: (Variable 3 a In () Default (Real 4 [(() ())]) Source Public), b: (Variable 3 b In () Default (Real 4 [(() ())]) Source Public), c: (Variable 3 c Out () Default (Real 4 [(() ())]) Source Public), i: (Variable 3 i Local () Default (Integer 4 []) Source Public), scalar: (Variable 3 scalar In () Default (Real 4 []) Source Public)}) triad [(Var 3 a) (Var 3 b) (Var 3 scalar) (Var 3 c)] [(= (Var 3 N) (FunctionCall 1 size () [(Var 3 a)] [] (Integer 4 []))) (DoConcurrentLoop ((Var 3 i) (ConstantInteger 1 (Integer 4 [])) (Var 3 N) ()) [(= (ArrayRef 3 c [(() (Var 3 i) ())] (Real 4 [(() ())])) (BinOp (ArrayRef 3 a [(() (Var 3 i) ())] (Real 4 [(() ())])) Add (BinOp (Var 3 scalar) Mul (ArrayRef 3 b [(() (Var 3 i) ())] (Real 4 [(() ())])) (Real 4 [])) (Real 4 [(() ())])))])] Source Public)}) kokkos_program2 [] [(= (Var 2 scalar) (ImplicitCast (ConstantInteger 10 (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 nsize) (FunctionCall 1 size () [(Var 2 a)] [] (Integer 4 []))) (DoConcurrentLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (Var 2 nsize) ()) [(= (ArrayRef 2 a [(() (Var 2 i) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))])) (ConstantInteger 5 (Integer 4 []))) (= (ArrayRef 2 b [(() (Var 2 i) ())] (Real 4 [((ConstantInteger 1 (Integer 4 [])) (ConstantInteger 10000 (Integer 4 [])))])) (ConstantInteger 5 (Integer 4 [])))]) (SubroutineCall 2 triad () [(Var 2 a) (Var 2 b) (Var 2 scalar) (Var 2 c)]) (Print () [(Str "End Stream Triad" (Character 8 []))])]), size: (Function (SymbolTable 4 {size: (Variable 4 size ReturnVar () Default (Integer 4 []) Source Public)}) size [] [] (Var 4 size) Source Public)}) []) diff --git a/tests/reference/asr-logical1-fd6d5c4.json b/tests/reference/asr-logical1-fd6d5c4.json index 8217c4d7d4..9db628aa61 100644 --- a/tests/reference/asr-logical1-fd6d5c4.json +++ b/tests/reference/asr-logical1-fd6d5c4.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-logical1-fd6d5c4.stdout", - "stdout_hash": "d26ff073aa60adc29e2b35a3d770da7bd4cbf4b532d17c8b6f19bb9c", + "stdout_hash": "eb1da561e8110581fbc7c942204f9d7a7ca7e79888f7cc732b78110c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-logical1-fd6d5c4.stdout b/tests/reference/asr-logical1-fd6d5c4.stdout index 889d06cfd0..acd489ea5c 100644 --- a/tests/reference/asr-logical1-fd6d5c4.stdout +++ b/tests/reference/asr-logical1-fd6d5c4.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {logical1: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 []) Source Public)}) logical1 [(= (Var 2 a) (ConstantLogical .true. (Logical 4 []))) (= (Var 2 b) (ConstantLogical .false. (Logical 4 []))) (Print () [(Var 2 a) (Var 2 b)])])}) []) +(TranslationUnit (SymbolTable 1 {logical1: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 []) Source Public)}) logical1 [] [(= (Var 2 a) (ConstantLogical .true. (Logical 4 []))) (= (Var 2 b) (ConstantLogical .false. (Logical 4 []))) (Print () [(Var 2 a) (Var 2 b)])])}) []) diff --git a/tests/reference/asr-logical2-e35f19c.json b/tests/reference/asr-logical2-e35f19c.json index 1a99e277e5..0ab9c9b1cf 100644 --- a/tests/reference/asr-logical2-e35f19c.json +++ b/tests/reference/asr-logical2-e35f19c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-logical2-e35f19c.stdout", - "stdout_hash": "791aac7116c105afea8fcb90f85336f0ef61d1eadbd2d984c590a5d7", + "stdout_hash": "08dcb48d90b36e99aa2546f906e579e3393ecf95f285a8730569b05d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-logical2-e35f19c.stdout b/tests/reference/asr-logical2-e35f19c.stdout index bbfdb7c664..60c6fc15dc 100644 --- a/tests/reference/asr-logical2-e35f19c.stdout +++ b/tests/reference/asr-logical2-e35f19c.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {logical2: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 []) Source Public)}) logical2 [(= (Var 2 a) (ConstantLogical .true. (Logical 4 []))) (= (Var 2 b) (ConstantLogical .false. (Logical 4 []))) (If (BoolOp (Var 2 a) And (Var 2 b) (Logical 4 [])) [(Print () [(Str "Line 1 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 1 - Condition is false" (Character 8 []))])])])}) []) +(TranslationUnit (SymbolTable 1 {logical2: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 []) Source Public)}) logical2 [] [(= (Var 2 a) (ConstantLogical .true. (Logical 4 []))) (= (Var 2 b) (ConstantLogical .false. (Logical 4 []))) (If (BoolOp (Var 2 a) And (Var 2 b) (Logical 4 [])) [(Print () [(Str "Line 1 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 1 - Condition is false" (Character 8 []))])])])}) []) diff --git a/tests/reference/asr-logical3-b6316c6.json b/tests/reference/asr-logical3-b6316c6.json index fd2d5d18fd..779f4fbb9e 100644 --- a/tests/reference/asr-logical3-b6316c6.json +++ b/tests/reference/asr-logical3-b6316c6.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-logical3-b6316c6.stdout", - "stdout_hash": "e22c61ccb653ddce63762bde927c3072140340162fa9ca0d6497a022", + "stdout_hash": "5e9d0e4af4b7f873b6d22d08b0f2b8691e887ff1ff24ab84918011dc", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-logical3-b6316c6.stdout b/tests/reference/asr-logical3-b6316c6.stdout index 1c7cd22473..bafce44655 100644 --- a/tests/reference/asr-logical3-b6316c6.stdout +++ b/tests/reference/asr-logical3-b6316c6.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {logical3: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 []) Source Public)}) logical3 [(= (Var 2 a) (ConstantLogical .true. (Logical 4 []))) (= (Var 2 b) (ConstantLogical .false. (Logical 4 []))) (If (BoolOp (Var 2 a) And (Var 2 b) (Logical 4 [])) [(Print () [(Str "Line 1 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 1 - Condition is false" (Character 8 []))])]) (If (BoolOp (Var 2 a) Or (Var 2 b) (Logical 4 [])) [(Print () [(Str "Line 2 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 2 - Condition is false" (Character 8 []))])]) (= (Var 2 a) (ConstantLogical .false. (Logical 4 []))) (= (Var 2 b) (ConstantLogical .true. (Logical 4 []))) (If (UnaryOp Not (BoolOp (Var 2 a) And (Var 2 b) (Logical 4 [])) (Logical 4 [])) [(Print () [(Str "Line 3 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 3 - Condition is false" (Character 8 []))])]) (If (BoolOp (Var 2 b) NEqv (Var 2 a) (Logical 4 [])) [(Print () [(Str "Line 4 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 4 - Condition is false" (Character 8 []))])]) (If (BoolOp (Var 2 b) Eqv (Var 2 a) (Logical 4 [])) [(Print () [(Str "Line 5 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 5 - Condition is false" (Character 8 []))])])])}) []) +(TranslationUnit (SymbolTable 1 {logical3: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 []) Source Public)}) logical3 [] [(= (Var 2 a) (ConstantLogical .true. (Logical 4 []))) (= (Var 2 b) (ConstantLogical .false. (Logical 4 []))) (If (BoolOp (Var 2 a) And (Var 2 b) (Logical 4 [])) [(Print () [(Str "Line 1 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 1 - Condition is false" (Character 8 []))])]) (If (BoolOp (Var 2 a) Or (Var 2 b) (Logical 4 [])) [(Print () [(Str "Line 2 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 2 - Condition is false" (Character 8 []))])]) (= (Var 2 a) (ConstantLogical .false. (Logical 4 []))) (= (Var 2 b) (ConstantLogical .true. (Logical 4 []))) (If (UnaryOp Not (BoolOp (Var 2 a) And (Var 2 b) (Logical 4 [])) (Logical 4 [])) [(Print () [(Str "Line 3 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 3 - Condition is false" (Character 8 []))])]) (If (BoolOp (Var 2 b) NEqv (Var 2 a) (Logical 4 [])) [(Print () [(Str "Line 4 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 4 - Condition is false" (Character 8 []))])]) (If (BoolOp (Var 2 b) Eqv (Var 2 a) (Logical 4 [])) [(Print () [(Str "Line 5 - Condition is true" (Character 8 []))])] [(Print () [(Str "Line 5 - Condition is false" (Character 8 []))])])])}) []) diff --git a/tests/reference/asr-logical4-72c2657.json b/tests/reference/asr-logical4-72c2657.json index 75c2185fc9..d32b8553bb 100644 --- a/tests/reference/asr-logical4-72c2657.json +++ b/tests/reference/asr-logical4-72c2657.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-logical4-72c2657.stdout", - "stdout_hash": "9ce7e626255026b80825e560f6c0471295ff5ff0c5d4c94b3c27a4ae", + "stdout_hash": "060d8358c19d897a91e52210fcd56ba75a1284ff3f4662961bf3087f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-logical4-72c2657.stdout b/tests/reference/asr-logical4-72c2657.stdout index 225e876b00..ccec6a3e05 100644 --- a/tests/reference/asr-logical4-72c2657.stdout +++ b/tests/reference/asr-logical4-72c2657.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {logical4: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 []) Source Public), c: (Variable 2 c Local () Default (Logical 4 []) Source Public)}) logical4 [(= (Var 2 a) (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToLogical (Logical 4 []))) (= (Var 2 b) (ImplicitCast (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) IntegerToLogical (Logical 4 []))) (= (Var 2 c) (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToLogical (Logical 4 []))) (Print () [(Var 2 a) (Var 2 b) (Var 2 c)])])}) []) +(TranslationUnit (SymbolTable 1 {logical4: (Program (SymbolTable 2 {a: (Variable 2 a Local () Default (Logical 4 []) Source Public), b: (Variable 2 b Local () Default (Logical 4 []) Source Public), c: (Variable 2 c Local () Default (Logical 4 []) Source Public)}) logical4 [] [(= (Var 2 a) (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToLogical (Logical 4 []))) (= (Var 2 b) (ImplicitCast (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) IntegerToLogical (Logical 4 []))) (= (Var 2 c) (ImplicitCast (ConstantInteger 0 (Integer 4 [])) IntegerToLogical (Logical 4 []))) (Print () [(Var 2 a) (Var 2 b) (Var 2 c)])])}) []) diff --git a/tests/reference/asr-modules_01-3535389.json b/tests/reference/asr-modules_01-3535389.json index 7ca32410e3..877afdc7ed 100644 --- a/tests/reference/asr-modules_01-3535389.json +++ b/tests/reference/asr-modules_01-3535389.json @@ -2,11 +2,11 @@ "basename": "asr-modules_01-3535389", "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/modules_01.f90", - "infile_hash": "697383eb5d15cbcf71af84f8421bbe2d4e7a7d094c24b90d5b0c4678", + "infile_hash": "17c761eb72726e0dde59f2b21f98f2402d783613834e927c49047534", "outfile": null, "outfile_hash": null, "stdout": "asr-modules_01-3535389.stdout", - "stdout_hash": "2b991943060526ac99def99bcf6090304b8a43349608c173a9188735", + "stdout_hash": "b35388872fa4545337d30db3f47a468ebe1c39b5747d58832037246f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-modules_01-3535389.stdout b/tests/reference/asr-modules_01-3535389.stdout index a795c5d6f4..d249f293e2 100644 --- a/tests/reference/asr-modules_01-3535389.stdout +++ b/tests/reference/asr-modules_01-3535389.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {a: (Module (SymbolTable 2 {b: (Subroutine (SymbolTable 3 {}) b [] [(Print () [(Str "b()" (Character 8 []))])] Source Public)}) a), modules_01: (Program (SymbolTable 4 {b: (ExternalSymbol 4 b 2 b Public)}) modules_01 [(SubroutineCall 2 b 4 b [])])}) []) +(TranslationUnit (SymbolTable 1 {a_01: (Module (SymbolTable 2 {b: (Subroutine (SymbolTable 3 {}) b [] [(Print () [(Str "b()" (Character 8 []))])] Source Public)}) a_01 [] .false.), modules_01: (Program (SymbolTable 4 {b: (ExternalSymbol 4 b 2 b a_01 b Public)}) modules_01 [a_01] [(SubroutineCall 4 b () [])])}) []) diff --git a/tests/reference/asr-modules_02-74be421.json b/tests/reference/asr-modules_02-74be421.json index ebfebf38a2..f6cee49c94 100644 --- a/tests/reference/asr-modules_02-74be421.json +++ b/tests/reference/asr-modules_02-74be421.json @@ -2,11 +2,11 @@ "basename": "asr-modules_02-74be421", "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/modules_02.f90", - "infile_hash": "0017a1f6dd0f8cec33539f6ae2dade51b7c4e4756968d9c423a9ac66", + "infile_hash": "887bcd0c13724335791cfd2de3e820c61e06230aa7bfc9ff56b446c1", "outfile": null, "outfile_hash": null, "stdout": "asr-modules_02-74be421.stdout", - "stdout_hash": "e8ccfd1bdb0f09fbb4ecd85d241cc1abec06dff52ffbc9dadfe2d666", + "stdout_hash": "c085a197a9fa835ad8d3337b3d1dba08df7a433dbf55f08e15b661ec", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-modules_02-74be421.stdout b/tests/reference/asr-modules_02-74be421.stdout index 8deb4ac052..2efaf7bbe6 100644 --- a/tests/reference/asr-modules_02-74be421.stdout +++ b/tests/reference/asr-modules_02-74be421.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {a: (Module (SymbolTable 2 {b: (Subroutine (SymbolTable 3 {}) b [] [(Print () [(Str "b()" (Character 8 []))])] Source Public)}) a), c: (Module (SymbolTable 4 {d: (Subroutine (SymbolTable 5 {}) d [] [(Print () [(Str "d()" (Character 8 []))])] Source Public)}) c), modules_02: (Program (SymbolTable 6 {b: (ExternalSymbol 6 b 2 b Public), x: (ExternalSymbol 6 x 4 d Public)}) modules_02 [(SubroutineCall 2 b 6 b []) (SubroutineCall 4 d 6 x [])])}) []) +(TranslationUnit (SymbolTable 1 {a_02: (Module (SymbolTable 2 {b: (Subroutine (SymbolTable 3 {}) b [] [(Print () [(Str "b()" (Character 8 []))])] Source Public)}) a_02 [] .false.), c_02: (Module (SymbolTable 4 {d: (Subroutine (SymbolTable 5 {}) d [] [(Print () [(Str "d()" (Character 8 []))])] Source Public), e: (Subroutine (SymbolTable 6 {}) e [] [(Print () [(Str "e()" (Character 8 []))])] Source Public)}) c_02 [] .false.), modules_02: (Program (SymbolTable 7 {b: (ExternalSymbol 7 b 2 b a_02 b Public), e: (ExternalSymbol 7 e 4 e c_02 e Public), x: (ExternalSymbol 7 x 4 d c_02 d Public)}) modules_02 [a_02 c_02] [(SubroutineCall 7 b () []) (SubroutineCall 7 x () []) (SubroutineCall 7 e () [])])}) []) diff --git a/tests/reference/asr-modules_03-54c2520.json b/tests/reference/asr-modules_03-54c2520.json index 9942aa885e..6f5dda2ff0 100644 --- a/tests/reference/asr-modules_03-54c2520.json +++ b/tests/reference/asr-modules_03-54c2520.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-modules_03-54c2520.stdout", - "stdout_hash": "2a412a62ec393f179cec10feb705d0df87f202e0f2bab96b0b711ae2", + "stdout_hash": "f5d702299f5f7bd3ba6f2bd06191a15cb52709c5f07f28be68508f03", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-modules_03-54c2520.stdout b/tests/reference/asr-modules_03-54c2520.stdout index 9d279f4f23..ed8e744ced 100644 --- a/tests/reference/asr-modules_03-54c2520.stdout +++ b/tests/reference/asr-modules_03-54c2520.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {access_vars: (Module (SymbolTable 2 {print_vars: (Subroutine (SymbolTable 3 {}) print_vars [] [(Print () [(Str "priv = " (Character 8 [])) (Var 2 priv)]) (Print () [(Str "publ = " (Character 8 [])) (Var 2 publ)])] Source Public), priv: (Variable 2 priv Local (ConstantReal "1.5" (Real 4 [])) Default (Real 4 []) Source Private), publ: (Variable 2 publ Local (ConstantReal "2.5" (Real 4 [])) Default (Real 4 []) Source Public)}) access_vars)}) []) +(TranslationUnit (SymbolTable 1 {access_vars: (Module (SymbolTable 2 {print_vars: (Subroutine (SymbolTable 3 {}) print_vars [] [(Print () [(Str "priv = " (Character 8 [])) (Var 2 priv)]) (Print () [(Str "publ = " (Character 8 [])) (Var 2 publ)])] Source Public), priv: (Variable 2 priv Local (ConstantReal "1.5" (Real 4 [])) Default (Real 4 []) Source Private), publ: (Variable 2 publ Local (ConstantReal "2.5" (Real 4 [])) Default (Real 4 []) Source Public)}) access_vars [] .false.)}) []) diff --git a/tests/reference/asr-modules_04-0d478be.json b/tests/reference/asr-modules_04-0d478be.json index b1945b8ed6..9dcc85801c 100644 --- a/tests/reference/asr-modules_04-0d478be.json +++ b/tests/reference/asr-modules_04-0d478be.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-modules_04-0d478be.stdout", - "stdout_hash": "2a412a62ec393f179cec10feb705d0df87f202e0f2bab96b0b711ae2", + "stdout_hash": "f5d702299f5f7bd3ba6f2bd06191a15cb52709c5f07f28be68508f03", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-modules_04-0d478be.stdout b/tests/reference/asr-modules_04-0d478be.stdout index 9d279f4f23..ed8e744ced 100644 --- a/tests/reference/asr-modules_04-0d478be.stdout +++ b/tests/reference/asr-modules_04-0d478be.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {access_vars: (Module (SymbolTable 2 {print_vars: (Subroutine (SymbolTable 3 {}) print_vars [] [(Print () [(Str "priv = " (Character 8 [])) (Var 2 priv)]) (Print () [(Str "publ = " (Character 8 [])) (Var 2 publ)])] Source Public), priv: (Variable 2 priv Local (ConstantReal "1.5" (Real 4 [])) Default (Real 4 []) Source Private), publ: (Variable 2 publ Local (ConstantReal "2.5" (Real 4 [])) Default (Real 4 []) Source Public)}) access_vars)}) []) +(TranslationUnit (SymbolTable 1 {access_vars: (Module (SymbolTable 2 {print_vars: (Subroutine (SymbolTable 3 {}) print_vars [] [(Print () [(Str "priv = " (Character 8 [])) (Var 2 priv)]) (Print () [(Str "publ = " (Character 8 [])) (Var 2 publ)])] Source Public), priv: (Variable 2 priv Local (ConstantReal "1.5" (Real 4 [])) Default (Real 4 []) Source Private), publ: (Variable 2 publ Local (ConstantReal "2.5" (Real 4 [])) Default (Real 4 []) Source Public)}) access_vars [] .false.)}) []) diff --git a/tests/reference/asr-modules_05-f939cc6.json b/tests/reference/asr-modules_05-f939cc6.json index 8472fe8919..da66dcf663 100644 --- a/tests/reference/asr-modules_05-f939cc6.json +++ b/tests/reference/asr-modules_05-f939cc6.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-modules_05-f939cc6.stdout", - "stdout_hash": "d488a23c632905b97bcdfbe66a04f9cbf4191b9f33512776553a24de", + "stdout_hash": "bd587333e20d14733d91801a7ab47431ac7380d2f1dfede5c8f70c24", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-modules_05-f939cc6.stdout b/tests/reference/asr-modules_05-f939cc6.stdout index eed6f06b2b..a29cfd62e3 100644 --- a/tests/reference/asr-modules_05-f939cc6.stdout +++ b/tests/reference/asr-modules_05-f939cc6.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {access_vars: (Module (SymbolTable 2 {print_vars: (Function (SymbolTable 3 {a: (Variable 3 a In () Default (Real 4 []) Source Private), b: (Variable 3 b In () Default (Real 4 []) Source Private), print_vars: (Variable 3 print_vars ReturnVar () Default (Integer 4 []) Source Public)}) print_vars [(Var 3 a) (Var 3 b)] [(Print () [(Str "priv = " (Character 8 [])) (Var 3 a)]) (Print () [(Str "publ = " (Character 8 [])) (Var 3 b)]) (= (Var 3 print_vars) (ConstantInteger 1 (Integer 4 [])))] (Var 3 print_vars) Source Private), priv: (Variable 2 priv Local (ConstantReal "1.5" (Real 4 [])) Default (Real 4 []) Source Private), publ: (Variable 2 publ Local (ConstantReal "2.5" (Real 4 [])) Default (Real 4 []) Source Public)}) access_vars)}) []) +(TranslationUnit (SymbolTable 1 {access_vars: (Module (SymbolTable 2 {print_vars: (Function (SymbolTable 3 {a: (Variable 3 a In () Default (Real 4 []) Source Private), b: (Variable 3 b In () Default (Real 4 []) Source Private), print_vars: (Variable 3 print_vars ReturnVar () Default (Integer 4 []) Source Public)}) print_vars [(Var 3 a) (Var 3 b)] [(Print () [(Str "priv = " (Character 8 [])) (Var 3 a)]) (Print () [(Str "publ = " (Character 8 [])) (Var 3 b)]) (= (Var 3 print_vars) (ConstantInteger 1 (Integer 4 [])))] (Var 3 print_vars) Source Private), priv: (Variable 2 priv Local (ConstantReal "1.5" (Real 4 [])) Default (Real 4 []) Source Private), publ: (Variable 2 publ Local (ConstantReal "2.5" (Real 4 [])) Default (Real 4 []) Source Public)}) access_vars [] .false.)}) []) diff --git a/tests/reference/asr-modules_06-609dd30.json b/tests/reference/asr-modules_06-609dd30.json index 4b8240876d..2036dff2f2 100644 --- a/tests/reference/asr-modules_06-609dd30.json +++ b/tests/reference/asr-modules_06-609dd30.json @@ -2,11 +2,11 @@ "basename": "asr-modules_06-609dd30", "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/modules_06.f90", - "infile_hash": "b557e356e3fb2b4c6c9592afc7b92c2f7ab6faa135823569d9ab079d", + "infile_hash": "5c41285ce39e1fc24c7cb3c89e4638d3a606e5d2c48a470da7a245b7", "outfile": null, "outfile_hash": null, "stdout": "asr-modules_06-609dd30.stdout", - "stdout_hash": "1bcde48a2a9cf9de76c1cc9bda3d4bb0b900b2747bea9a287f758eb4", + "stdout_hash": "9ae39b1e5f2332c6c5467e20a4ff9f83ca4f1c2e1b452fabaa18d633", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-modules_06-609dd30.stdout b/tests/reference/asr-modules_06-609dd30.stdout index 1e750350c8..1591e7dfbd 100644 --- a/tests/reference/asr-modules_06-609dd30.stdout +++ b/tests/reference/asr-modules_06-609dd30.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {a: (Module (SymbolTable 2 {b: (Function (SymbolTable 3 {r: (Variable 3 r ReturnVar () Default (Integer 4 []) Source Public)}) b [] [(Print () [(Str "b()" (Character 8 []))]) (= (Var 3 r) (ConstantInteger 5 (Integer 4 [])))] (Var 3 r) Source Public)}) a), modules_06: (Program (SymbolTable 4 {b: (ExternalSymbol 4 b 2 b Public), i: (Variable 4 i Local () Default (Integer 4 []) Source Public)}) modules_06 [(= (Var 4 i) (FuncCall 2 b 4 b [] [] (Integer 4 []))) (Print () [(Var 4 i)])])}) []) +(TranslationUnit (SymbolTable 1 {a_06: (Module (SymbolTable 2 {b: (Function (SymbolTable 3 {r: (Variable 3 r ReturnVar () Default (Integer 4 []) Source Public)}) b [] [(Print () [(Str "b()" (Character 8 []))]) (= (Var 3 r) (ConstantInteger 5 (Integer 4 [])))] (Var 3 r) Source Public)}) a_06 [] .false.), modules_06: (Program (SymbolTable 4 {b: (ExternalSymbol 4 b 2 b a_06 b Public), i: (Variable 4 i Local () Default (Integer 4 []) Source Public)}) modules_06 [a_06] [(= (Var 4 i) (FunctionCall 4 b () [] [] (Integer 4 []))) (Print () [(Var 4 i)])])}) []) diff --git a/tests/reference/asr-modules_06-821cc56.json b/tests/reference/asr-modules_06-821cc56.json new file mode 100644 index 0000000000..5b84b7bb2b --- /dev/null +++ b/tests/reference/asr-modules_06-821cc56.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-modules_06-821cc56", + "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/modules_06.f90", + "infile_hash": "7699c2084686f687c1681ea9d088f613f3530b48449a37df5fc1cdce", + "outfile": null, + "outfile_hash": null, + "stdout": "asr-modules_06-821cc56.stdout", + "stdout_hash": "1249ef1377180b9f783399406cd6089f1705a685820fdaf657a19689", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/asr-modules_06-821cc56.stdout b/tests/reference/asr-modules_06-821cc56.stdout new file mode 100644 index 0000000000..2b5b231f53 --- /dev/null +++ b/tests/reference/asr-modules_06-821cc56.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {modules_06_a: (Module (SymbolTable 4 {a: (Function (SymbolTable 5 {a: (Variable 5 a ReturnVar () Default (Integer 4 []) Source Public)}) a [] [(= (Var 5 a) (BinOp (ConstantInteger 3 (Integer 4 [])) Add (FunctionCall 4 b () [] [] (Integer 4 [])) (Integer 4 [])))] (Var 5 a) Source Public), b: (ExternalSymbol 4 b 2 b modules_06_b b Private)}) modules_06_a [modules_06_b] .false.), modules_06_b: (Module (SymbolTable 2 {b: (Function (SymbolTable 3 {b: (Variable 3 b ReturnVar () Default (Integer 4 []) Source Public)}) b [] [(= (Var 3 b) (ConstantInteger 5 (Integer 4 [])))] (Var 3 b) Source Public)}) modules_06_b [] .false.)}) []) diff --git a/tests/reference/asr-nested_01-290187e.json b/tests/reference/asr-nested_01-290187e.json index 6735e64815..6a51d517cc 100644 --- a/tests/reference/asr-nested_01-290187e.json +++ b/tests/reference/asr-nested_01-290187e.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-nested_01-290187e.stdout", - "stdout_hash": "f1385fa363b8dfc47fcf70368a9ae3beca86a6d4e13b811f8a8566f2", + "stdout_hash": "66a9d327efdeec3f0b61ad4b49714d69c6c8a009510631ce403627a6", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-nested_01-290187e.stdout b/tests/reference/asr-nested_01-290187e.stdout index e4f99bb332..f21b810f08 100644 --- a/tests/reference/asr-nested_01-290187e.stdout +++ b/tests/reference/asr-nested_01-290187e.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {a: (Module (SymbolTable 2 {b: (Function (SymbolTable 3 {b: (Variable 3 b ReturnVar () Default (Integer 4 []) Source Public), d: (Function (SymbolTable 4 {d: (Variable 4 d ReturnVar () Default (Integer 4 []) Source Public)}) d [] [(Print () [(Str "d()" (Character 8 []))]) (= (Var 4 d) (ConstantInteger 1 (Integer 4 [])))] (Var 4 d) Source Public), e: (Variable 3 e Local () Default (Integer 4 []) Source Public)}) b [] [(Print () [(Str "b()" (Character 8 []))]) (= (Var 3 e) (FuncCall 3 d () [] [] (Integer 4 []))) (= (Var 3 b) (ConstantInteger 0 (Integer 4 [])))] (Var 3 b) Source Public)}) a), nested_01: (Program (SymbolTable 5 {b: (ExternalSymbol 5 b 2 b Public), c: (Variable 5 c Local () Default (Integer 4 []) Source Public)}) nested_01 [(= (Var 5 c) (FuncCall 2 b 5 b [] [] (Integer 4 [])))])}) []) +(TranslationUnit (SymbolTable 1 {a: (Module (SymbolTable 2 {b: (Function (SymbolTable 3 {b: (Variable 3 b ReturnVar () Default (Integer 4 []) Source Public), d: (Function (SymbolTable 4 {d: (Variable 4 d ReturnVar () Default (Integer 4 []) Source Public)}) d [] [(Print () [(Str "d()" (Character 8 []))]) (= (Var 4 d) (ConstantInteger 1 (Integer 4 [])))] (Var 4 d) Source Public), e: (Variable 3 e Local () Default (Integer 4 []) Source Public)}) b [] [(Print () [(Str "b()" (Character 8 []))]) (= (Var 3 e) (FunctionCall 3 d () [] [] (Integer 4 []))) (= (Var 3 b) (ConstantInteger 0 (Integer 4 [])))] (Var 3 b) Source Public)}) a [] .false.), nested_01: (Program (SymbolTable 5 {b: (ExternalSymbol 5 b 2 b a b Public), c: (Variable 5 c Local () Default (Integer 4 []) Source Public)}) nested_01 [a] [(= (Var 5 c) (FunctionCall 5 b () [] [] (Integer 4 [])))])}) []) diff --git a/tests/reference/asr-nested_02-8302041.json b/tests/reference/asr-nested_02-8302041.json index a54b80059c..9359c1f308 100644 --- a/tests/reference/asr-nested_02-8302041.json +++ b/tests/reference/asr-nested_02-8302041.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-nested_02-8302041.stdout", - "stdout_hash": "0e82ac4ecf1d4787b063e027e1d790ae920267eb25acf96304456603", + "stdout_hash": "8f49ecb8d8300f9119c0f0a141964816e42bc7c39309a78f9580c00f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-nested_02-8302041.stdout b/tests/reference/asr-nested_02-8302041.stdout index 34240e0e03..52cca2a695 100644 --- a/tests/reference/asr-nested_02-8302041.stdout +++ b/tests/reference/asr-nested_02-8302041.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {a: (Module (SymbolTable 2 {b: (Subroutine (SymbolTable 3 {c: (Subroutine (SymbolTable 4 {}) c [] [(Print () [(ConstantInteger 5 (Integer 4 []))])] Source Public)}) b [] [(Print () [(Str "b()" (Character 8 []))]) (SubroutineCall 3 c () [])] Source Public)}) a), nested_02: (Program (SymbolTable 5 {b: (ExternalSymbol 5 b 2 b Public)}) nested_02 [(SubroutineCall 2 b 5 b [])])}) []) +(TranslationUnit (SymbolTable 1 {a: (Module (SymbolTable 2 {b: (Subroutine (SymbolTable 3 {c: (Subroutine (SymbolTable 4 {}) c [] [(Print () [(ConstantInteger 5 (Integer 4 []))])] Source Public)}) b [] [(Print () [(Str "b()" (Character 8 []))]) (SubroutineCall 3 c () [])] Source Public)}) a [] .false.), nested_02: (Program (SymbolTable 5 {b: (ExternalSymbol 5 b 2 b a b Public)}) nested_02 [a] [(SubroutineCall 5 b () [])])}) []) diff --git a/tests/reference/asr-program1-17e5471.json b/tests/reference/asr-program1-17e5471.json index df538a1881..4292e338a2 100644 --- a/tests/reference/asr-program1-17e5471.json +++ b/tests/reference/asr-program1-17e5471.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-program1-17e5471.stdout", - "stdout_hash": "02cb9c63c817cf478266df7b9ba007d9ef446d4af2aa801417c6407e", + "stdout_hash": "3af6f5c096942706dd71b82c187501a070db2c38b9acff6c25a3c9aa", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-program1-17e5471.stdout b/tests/reference/asr-program1-17e5471.stdout index fd726264f4..0f0b2f8477 100644 --- a/tests/reference/asr-program1-17e5471.stdout +++ b/tests/reference/asr-program1-17e5471.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {program1: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public)}) program1 [(= (Var 2 i) (ConstantInteger 5 (Integer 4 []))) (Print () [(Var 2 i)]) (Print () [(BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))])])}) []) +(TranslationUnit (SymbolTable 1 {program1: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public)}) program1 [] [(= (Var 2 i) (ConstantInteger 5 (Integer 4 []))) (Print () [(Var 2 i)]) (Print () [(BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))])])}) []) diff --git a/tests/reference/asr-program_cmake_01-a9e6179.json b/tests/reference/asr-program_cmake_01-a9e6179.json index d64601f0b9..aa5ccbeead 100644 --- a/tests/reference/asr-program_cmake_01-a9e6179.json +++ b/tests/reference/asr-program_cmake_01-a9e6179.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-program_cmake_01-a9e6179.stdout", - "stdout_hash": "69213883dc36e22cd96e66f02b1c99b16c11cd88a817b78e4587882d", + "stdout_hash": "d7e0799b65c890a83a5757d8ec352274da43c0de3a0477e2dfb3f01e", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-program_cmake_01-a9e6179.stdout b/tests/reference/asr-program_cmake_01-a9e6179.stdout index 9291f08e98..ce46119417 100644 --- a/tests/reference/asr-program_cmake_01-a9e6179.stdout +++ b/tests/reference/asr-program_cmake_01-a9e6179.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {TESTFortran: (Program (SymbolTable 2 {}) TESTFortran [(Print () [(Str "Hello" (Character 8 []))])])}) []) +(TranslationUnit (SymbolTable 1 {TESTFortran: (Program (SymbolTable 2 {}) TESTFortran [] [(Print () [(Str "Hello" (Character 8 []))])])}) []) diff --git a/tests/reference/asr-real_dp-d1d5467.json b/tests/reference/asr-real_dp-d1d5467.json index 6dab51326e..370ca92b69 100644 --- a/tests/reference/asr-real_dp-d1d5467.json +++ b/tests/reference/asr-real_dp-d1d5467.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-real_dp-d1d5467.stdout", - "stdout_hash": "2279f6b2780a4c83cdaff012079f83b54e007fa97350511c9634e53f", + "stdout_hash": "89f0a8b912143eccf027eb8c93f44e3989ad4cfde7add82c08b11bca", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-real_dp-d1d5467.stdout b/tests/reference/asr-real_dp-d1d5467.stdout index af84673d87..23d1e21d46 100644 --- a/tests/reference/asr-real_dp-d1d5467.stdout +++ b/tests/reference/asr-real_dp-d1d5467.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {real_dp: (Program (SymbolTable 2 {v: (Variable 2 v Local () Default (Real 8 []) Source Public), x: (Variable 2 x Local () Default (Real 4 []) Source Public), zero: (Variable 2 zero Local () Default (Real 4 []) Source Public)}) real_dp [(= (Var 2 zero) (ConstantReal "0.0" (Real 4 []))) (= (Var 2 v) (ImplicitCast (ConstantReal "1.05" (Real 4 [])) RealToReal (Real 8 []))) (= (Var 2 x) (ConstantReal "1.05" (Real 4 []))) (Print () [(Var 2 x) (Var 2 v) (Var 2 zero)])])}) []) +(TranslationUnit (SymbolTable 1 {real_dp: (Program (SymbolTable 2 {v: (Variable 2 v Local () Default (Real 8 []) Source Public), x: (Variable 2 x Local () Default (Real 4 []) Source Public), zero: (Variable 2 zero Local () Default (Real 4 []) Source Public)}) real_dp [] [(= (Var 2 zero) (ConstantReal "0.0" (Real 4 []))) (= (Var 2 v) (ImplicitCast (ConstantReal "1.05" (Real 4 [])) RealToReal (Real 8 []))) (= (Var 2 x) (ConstantReal "1.05" (Real 4 []))) (Print () [(Var 2 x) (Var 2 v) (Var 2 zero)])])}) []) diff --git a/tests/reference/asr-real_dp_param-3adbc5b.json b/tests/reference/asr-real_dp_param-3adbc5b.json index 4eef7e384b..5db49b1739 100644 --- a/tests/reference/asr-real_dp_param-3adbc5b.json +++ b/tests/reference/asr-real_dp_param-3adbc5b.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-real_dp_param-3adbc5b.stdout", - "stdout_hash": "e19746b1e7e5950fef9ad8f0f56b95c5ebd1a2ebc28634184af22e5d", + "stdout_hash": "8bcbdd4b63f3596a512bb2d7934a08b3490aa96f2bf387613df0ebc6", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-real_dp_param-3adbc5b.stdout b/tests/reference/asr-real_dp_param-3adbc5b.stdout index eeced61b9a..bf56c62d39 100644 --- a/tests/reference/asr-real_dp_param-3adbc5b.stdout +++ b/tests/reference/asr-real_dp_param-3adbc5b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {real_dp_param: (Program (SymbolTable 2 {prec1: (Variable 2 prec1 Local (ConstantInteger 4 (Integer 4 [])) Parameter (Integer 4 []) Source Public), prec2: (Variable 2 prec2 Local (ConstantInteger 8 (Integer 4 [])) Parameter (Integer 4 []) Source Public), u: (Variable 2 u Local (ConstantReal "1.05" (Real 4 [])) Default (Real 4 []) Source Public), v: (Variable 2 v Local (ImplicitCast (ConstantReal "1.05" (Real 4 [])) RealToReal (Real 8 [])) Default (Real 8 []) Source Public), zero: (Variable 2 zero Local (ImplicitCast (ConstantReal "0.0_4" (Real 4 [])) RealToReal (Real 8 [])) Default (Real 8 []) Source Public)}) real_dp_param [(Print () [(Var 2 u) (Var 2 v) (Var 2 zero)])])}) []) +(TranslationUnit (SymbolTable 1 {real_dp_param: (Program (SymbolTable 2 {prec1: (Variable 2 prec1 Local (ConstantInteger 4 (Integer 4 [])) Parameter (Integer 4 []) Source Public), prec2: (Variable 2 prec2 Local (ConstantInteger 8 (Integer 4 [])) Parameter (Integer 4 []) Source Public), u: (Variable 2 u Local (ConstantReal "1.05" (Real 4 [])) Default (Real 4 []) Source Public), v: (Variable 2 v Local (ImplicitCast (ConstantReal "1.05" (Real 4 [])) RealToReal (Real 8 [])) Default (Real 8 []) Source Public), zero: (Variable 2 zero Local (ImplicitCast (ConstantReal "0.0_4" (Real 4 [])) RealToReal (Real 8 [])) Default (Real 8 []) Source Public)}) real_dp_param [] [(Print () [(Var 2 u) (Var 2 v) (Var 2 zero)])])}) []) diff --git a/tests/reference/asr-scopes1-502009a.json b/tests/reference/asr-scopes1-502009a.json index d116766c87..9baa08732a 100644 --- a/tests/reference/asr-scopes1-502009a.json +++ b/tests/reference/asr-scopes1-502009a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-scopes1-502009a.stdout", - "stdout_hash": "a3fe33d214ee7f359d4a56151f87bee3e4f99ac2409446f67b3b2785", + "stdout_hash": "95f1825dc5acf072f8f9fa7735196c7829755575ab4c2ed2c08135ed", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-scopes1-502009a.stdout b/tests/reference/asr-scopes1-502009a.stdout index a143527a17..2defd0a092 100644 --- a/tests/reference/asr-scopes1-502009a.stdout +++ b/tests/reference/asr-scopes1-502009a.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {scopes1: (Program (SymbolTable 2 {f: (Subroutine (SymbolTable 3 {b: (Variable 3 b Out () Default (Integer 4 []) Source Public)}) f [(Var 3 b)] [(= (Var 3 b) (BinOp (Var 2 j) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) scopes1 [(= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (SubroutineCall 2 f () [(Var 2 i)])])}) []) +(TranslationUnit (SymbolTable 1 {scopes1: (Program (SymbolTable 2 {f: (Subroutine (SymbolTable 3 {b: (Variable 3 b Out () Default (Integer 4 []) Source Public)}) f [(Var 3 b)] [(= (Var 3 b) (BinOp (Var 2 j) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) scopes1 [] [(= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (SubroutineCall 2 f () [(Var 2 i)])])}) []) diff --git a/tests/reference/asr-stop-c3f410b.json b/tests/reference/asr-stop-c3f410b.json index 2074ee19fe..3eab4c0342 100644 --- a/tests/reference/asr-stop-c3f410b.json +++ b/tests/reference/asr-stop-c3f410b.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-stop-c3f410b.stdout", - "stdout_hash": "d34dfd588b00e5957bc9bfcf9c56613008c5abe4031b603df241f86b", + "stdout_hash": "9c64e3a73e9458e268fdc6b7d66e14c7ad70294a337a9389a3097c4b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-stop-c3f410b.stdout b/tests/reference/asr-stop-c3f410b.stdout index 5cec451f67..c770b4082d 100644 --- a/tests/reference/asr-stop-c3f410b.stdout +++ b/tests/reference/asr-stop-c3f410b.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {stop: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Integer 4 []) Source Public)}) stop [(= (Var 2 x) (BinOp (BinOp (ConstantInteger 2 (Integer 4 [])) Add (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) Mul (ConstantInteger 5 (Integer 4 [])) (Integer 4 []))) (If (Compare (Var 2 x) Eq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(Stop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {stop: (Program (SymbolTable 2 {x: (Variable 2 x Local () Default (Integer 4 []) Source Public)}) stop [] [(= (Var 2 x) (BinOp (BinOp (ConstantInteger 2 (Integer 4 [])) Add (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) Mul (ConstantInteger 5 (Integer 4 [])) (Integer 4 []))) (If (Compare (Var 2 x) Eq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(Stop ())] [])])}) []) diff --git a/tests/reference/asr-string1-94ec834.json b/tests/reference/asr-string1-94ec834.json index e036e81f3d..bab1689002 100644 --- a/tests/reference/asr-string1-94ec834.json +++ b/tests/reference/asr-string1-94ec834.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-string1-94ec834.stdout", - "stdout_hash": "0d535df4397fba0f23a4e67f9b73140e62ac93f690fa5ff973bdb8d4", + "stdout_hash": "b63a51c4a6f99a24df7ab4dfddceb516a18a3987a757f7a838b20fdc", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-string1-94ec834.stdout b/tests/reference/asr-string1-94ec834.stdout index 64cb599755..445bd43eee 100644 --- a/tests/reference/asr-string1-94ec834.stdout +++ b/tests/reference/asr-string1-94ec834.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {print_my_name: (Program (SymbolTable 2 {my_name: (Variable 2 my_name Local (Str "Dominic" (Character 8 [])) Default (Character 4 []) Source Public)}) print_my_name [(Print () [(Str "My name is " (Character 8 [])) (Var 2 my_name)])])}) []) +(TranslationUnit (SymbolTable 1 {print_my_name: (Program (SymbolTable 2 {my_name: (Variable 2 my_name Local (Str "Dominic" (Character 8 [])) Default (Character 4 []) Source Public)}) print_my_name [] [(Print () [(Str "My name is " (Character 8 [])) (Var 2 my_name)])])}) []) diff --git a/tests/reference/asr-string2-86eecd9.json b/tests/reference/asr-string2-86eecd9.json index bba4615585..10ef39260e 100644 --- a/tests/reference/asr-string2-86eecd9.json +++ b/tests/reference/asr-string2-86eecd9.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-string2-86eecd9.stdout", - "stdout_hash": "16f1031833e022cdb61af9d6205c2826a04b40b5ef687245af0af818", + "stdout_hash": "94acdb10c18078de9be695788cc83b434f06c18a9f6c2894cb246dc2", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-string2-86eecd9.stdout b/tests/reference/asr-string2-86eecd9.stdout index d27e83ab96..e0b1e78648 100644 --- a/tests/reference/asr-string2-86eecd9.stdout +++ b/tests/reference/asr-string2-86eecd9.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {character1: (Program (SymbolTable 2 {firstname: (Variable 2 firstname Local () Default (Character 4 []) Source Public), greetings: (Variable 2 greetings Local () Default (Character 4 []) Source Public), surname: (Variable 2 surname Local () Default (Character 4 []) Source Public), title: (Variable 2 title Local () Default (Character 4 []) Source Public)}) character1 [(= (Var 2 title) (Str "Mr. " (Character 8 []))) (= (Var 2 firstname) (Str "Rowan " (Character 8 []))) (= (Var 2 surname) (Str "Atkinson" (Character 8 []))) (= (Var 2 greetings) (Str "A big hello from Mr. Bean" (Character 8 []))) (Print () [(Str "Here is " (Character 8 [])) (Var 2 title) (Var 2 firstname) (Var 2 surname)]) (Print () [(Var 2 greetings)])])}) []) +(TranslationUnit (SymbolTable 1 {character1: (Program (SymbolTable 2 {firstname: (Variable 2 firstname Local () Default (Character 4 []) Source Public), greetings: (Variable 2 greetings Local () Default (Character 4 []) Source Public), surname: (Variable 2 surname Local () Default (Character 4 []) Source Public), title: (Variable 2 title Local () Default (Character 4 []) Source Public)}) character1 [] [(= (Var 2 title) (Str "Mr. " (Character 8 []))) (= (Var 2 firstname) (Str "Rowan " (Character 8 []))) (= (Var 2 surname) (Str "Atkinson" (Character 8 []))) (= (Var 2 greetings) (Str "A big hello from Mr. Bean" (Character 8 []))) (Print () [(Str "Here is " (Character 8 [])) (Var 2 title) (Var 2 firstname) (Var 2 surname)]) (Print () [(Var 2 greetings)])])}) []) diff --git a/tests/reference/asr-string3-aa1dc1c.json b/tests/reference/asr-string3-aa1dc1c.json index 24220180c9..88ad7b1694 100644 --- a/tests/reference/asr-string3-aa1dc1c.json +++ b/tests/reference/asr-string3-aa1dc1c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-string3-aa1dc1c.stdout", - "stdout_hash": "ebfbc4cf253158ab88857d927cd83c32a284910515f5d521f27ffa23", + "stdout_hash": "6d1dc60a60e2249b52204dfa368fae21ca10ac2c7e4ce8c934272273", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-string3-aa1dc1c.stdout b/tests/reference/asr-string3-aa1dc1c.stdout index 03b510cc3d..9de5c14063 100644 --- a/tests/reference/asr-string3-aa1dc1c.stdout +++ b/tests/reference/asr-string3-aa1dc1c.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {dr_fortran: (Program (SymbolTable 2 {combined: (Variable 2 combined Local () Default (Character 4 []) Source Public), intro: (Variable 2 intro Local () Default (Character 4 []) Source Public), last_name: (Variable 2 last_name Local () Default (Character 4 []) Source Public), posit: (Variable 2 posit Local () Default (Character 4 []) Source Public), title: (Variable 2 title Local () Default (Character 4 []) Source Public), verb: (Variable 2 verb Local () Default (Character 4 []) Source Public)}) dr_fortran [(= (Var 2 intro) (Str "I've " (Character 8 []))) (= (Var 2 verb) (Str "learned " (Character 8 []))) (= (Var 2 posit) (Str "from " (Character 8 []))) (= (Var 2 title) (Str "Dr. " (Character 8 []))) (= (Var 2 last_name) (Str "Fortran" (Character 8 []))) (= (Var 2 combined) (StrOp (StrOp (StrOp (StrOp (Var 2 intro) Concat (Var 2 verb) (Character 4 [])) Concat (Var 2 posit) (Character 4 [])) Concat (Var 2 title) (Character 4 [])) Concat (Var 2 last_name) (Character 4 []))) (Print () [(Var 2 combined)])])}) []) +(TranslationUnit (SymbolTable 1 {dr_fortran: (Program (SymbolTable 2 {combined: (Variable 2 combined Local () Default (Character 4 []) Source Public), intro: (Variable 2 intro Local () Default (Character 4 []) Source Public), last_name: (Variable 2 last_name Local () Default (Character 4 []) Source Public), posit: (Variable 2 posit Local () Default (Character 4 []) Source Public), title: (Variable 2 title Local () Default (Character 4 []) Source Public), verb: (Variable 2 verb Local () Default (Character 4 []) Source Public)}) dr_fortran [] [(= (Var 2 intro) (Str "I've " (Character 8 []))) (= (Var 2 verb) (Str "learned " (Character 8 []))) (= (Var 2 posit) (Str "from " (Character 8 []))) (= (Var 2 title) (Str "Dr. " (Character 8 []))) (= (Var 2 last_name) (Str "Fortran" (Character 8 []))) (= (Var 2 combined) (StrOp (StrOp (StrOp (StrOp (Var 2 intro) Concat (Var 2 verb) (Character 4 [])) Concat (Var 2 posit) (Character 4 [])) Concat (Var 2 title) (Character 4 [])) Concat (Var 2 last_name) (Character 4 []))) (Print () [(Var 2 combined)])])}) []) diff --git a/tests/reference/asr-subroutine4-a425266.json b/tests/reference/asr-subroutine4-a425266.json index 259ffab74c..27cc3601a8 100644 --- a/tests/reference/asr-subroutine4-a425266.json +++ b/tests/reference/asr-subroutine4-a425266.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-subroutine4-a425266.stdout", - "stdout_hash": "a7973224eb74896c2956af50fafbb4fd771d21359cf95e61b42ebd58", + "stdout_hash": "0e77e06ba4d97c9d8732f44837b198ad6047d97e3dfd342ab4b70b03", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-subroutine4-a425266.stdout b/tests/reference/asr-subroutine4-a425266.stdout index 530f766e4b..52237d5c4b 100644 --- a/tests/reference/asr-subroutine4-a425266.stdout +++ b/tests/reference/asr-subroutine4-a425266.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {size: (Function (SymbolTable 3 {size: (Variable 3 size ReturnVar () Default (Integer 4 []) Source Public)}) size [] [] (Var 3 size) Source Public), triad: (Subroutine (SymbolTable 2 {N: (Variable 2 N Local () Default (Integer 4 []) Source Public), a: (Variable 2 a In () Default (Real 4 [(() ())]) Source Public), b: (Variable 2 b In () Default (Real 4 [(() ())]) Source Public), c: (Variable 2 c Out () Default (Real 4 [(() ())]) Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), scalar: (Variable 2 scalar In () Default (Real 4 []) Source Public)}) triad [(Var 2 a) (Var 2 b) (Var 2 scalar) (Var 2 c)] [(= (Var 2 N) (FuncCall 1 size () [(Var 2 a)] [] (Integer 4 []))) (DoConcurrentLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (Var 2 N) ()) [(= (ArrayRef 2 c [(() (Var 2 i) ())] (Real 4 [(() ())])) (BinOp (ArrayRef 2 a [(() (Var 2 i) ())] (Real 4 [(() ())])) Add (BinOp (Var 2 scalar) Mul (ArrayRef 2 b [(() (Var 2 i) ())] (Real 4 [(() ())])) (Real 4 [])) (Real 4 [(() ())])))])] Source Public)}) []) +(TranslationUnit (SymbolTable 1 {size: (Function (SymbolTable 3 {size: (Variable 3 size ReturnVar () Default (Integer 4 []) Source Public)}) size [] [] (Var 3 size) Source Public), triad: (Subroutine (SymbolTable 2 {N: (Variable 2 N Local () Default (Integer 4 []) Source Public), a: (Variable 2 a In () Default (Real 4 [(() ())]) Source Public), b: (Variable 2 b In () Default (Real 4 [(() ())]) Source Public), c: (Variable 2 c Out () Default (Real 4 [(() ())]) Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), scalar: (Variable 2 scalar In () Default (Real 4 []) Source Public)}) triad [(Var 2 a) (Var 2 b) (Var 2 scalar) (Var 2 c)] [(= (Var 2 N) (FunctionCall 1 size () [(Var 2 a)] [] (Integer 4 []))) (DoConcurrentLoop ((Var 2 i) (ConstantInteger 1 (Integer 4 [])) (Var 2 N) ()) [(= (ArrayRef 2 c [(() (Var 2 i) ())] (Real 4 [(() ())])) (BinOp (ArrayRef 2 a [(() (Var 2 i) ())] (Real 4 [(() ())])) Add (BinOp (Var 2 scalar) Mul (ArrayRef 2 b [(() (Var 2 i) ())] (Real 4 [(() ())])) (Real 4 [])) (Real 4 [(() ())])))])] Source Public)}) []) diff --git a/tests/reference/asr-subroutines_01-d48abaa.json b/tests/reference/asr-subroutines_01-d48abaa.json index 3955ccaccc..1cbdfd4f0e 100644 --- a/tests/reference/asr-subroutines_01-d48abaa.json +++ b/tests/reference/asr-subroutines_01-d48abaa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-subroutines_01-d48abaa.stdout", - "stdout_hash": "5929cdad9f334101acb4d794ebf21717ff272844c956bd96e3f593d5", + "stdout_hash": "de5831c2b42a2e35a653293fa92a3f9e2c3ac3181f561f437669ccb7", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-subroutines_01-d48abaa.stdout b/tests/reference/asr-subroutines_01-d48abaa.stdout index 1b284fec1b..96900633a7 100644 --- a/tests/reference/asr-subroutines_01-d48abaa.stdout +++ b/tests/reference/asr-subroutines_01-d48abaa.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {subroutines_01: (Program (SymbolTable 2 {f: (Subroutine (SymbolTable 3 {a: (Variable 3 a In () Default (Integer 4 []) Source Public), b: (Variable 3 b Out () Default (Integer 4 []) Source Public)}) f [(Var 3 a) (Var 3 b)] [(= (Var 3 b) (BinOp (Var 3 a) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) subroutines_01 [(= (Var 2 i) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 f () [(Var 2 i) (Var 2 j)]) (If (Compare (Var 2 i) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 j) NotEq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 f () [(ConstantInteger 3 (Integer 4 [])) (Var 2 j)]) (If (Compare (Var 2 j) NotEq (ConstantInteger 4 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 f () [(BinOp (ConstantInteger 1 (Integer 4 [])) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Var 2 j)]) (If (Compare (Var 2 j) NotEq (ConstantInteger 4 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 f () [(BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Var 2 j)]) (If (Compare (Var 2 j) NotEq (ConstantInteger 4 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {subroutines_01: (Program (SymbolTable 2 {f: (Subroutine (SymbolTable 3 {a: (Variable 3 a In () Default (Integer 4 []) Source Public), b: (Variable 3 b Out () Default (Integer 4 []) Source Public)}) f [(Var 3 a) (Var 3 b)] [(= (Var 3 b) (BinOp (Var 3 a) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) subroutines_01 [] [(= (Var 2 i) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 f () [(Var 2 i) (Var 2 j)]) (If (Compare (Var 2 i) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 j) NotEq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 f () [(ConstantInteger 3 (Integer 4 [])) (Var 2 j)]) (If (Compare (Var 2 j) NotEq (ConstantInteger 4 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 f () [(BinOp (ConstantInteger 1 (Integer 4 [])) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Var 2 j)]) (If (Compare (Var 2 j) NotEq (ConstantInteger 4 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 f () [(BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Var 2 j)]) (If (Compare (Var 2 j) NotEq (ConstantInteger 4 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/asr-subroutines_02-597f5e1.json b/tests/reference/asr-subroutines_02-597f5e1.json index 97d76f2067..c599f4c647 100644 --- a/tests/reference/asr-subroutines_02-597f5e1.json +++ b/tests/reference/asr-subroutines_02-597f5e1.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-subroutines_02-597f5e1.stdout", - "stdout_hash": "f7908cae9ecc682c4747306e81fdc8ef53f3e2db60d8341290346c37", + "stdout_hash": "26dce181927d03a115ae10cb21a1bb530287cb57d85199c68fb9a5f4", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-subroutines_02-597f5e1.stdout b/tests/reference/asr-subroutines_02-597f5e1.stdout index 404b4d386b..9e2e891a4b 100644 --- a/tests/reference/asr-subroutines_02-597f5e1.stdout +++ b/tests/reference/asr-subroutines_02-597f5e1.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {subroutines_02: (Program (SymbolTable 2 {f: (Subroutine (SymbolTable 3 {a: (Variable 3 a In () Default (Integer 4 []) Source Public), b: (Variable 3 b Out () Default (Integer 4 []) Source Public)}) f [(Var 3 a) (Var 3 b)] [(= (Var 3 b) (BinOp (Var 3 a) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), g: (Subroutine (SymbolTable 4 {a: (Variable 4 a In () Default (Integer 4 []) Source Public), b: (Variable 4 b Out () Default (Integer 4 []) Source Public)}) g [(Var 4 a) (Var 4 b)] [(= (Var 4 b) (BinOp (Var 4 a) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), h: (Subroutine (SymbolTable 5 {a: (Variable 5 a In () Default (Integer 4 []) Source Public), b: (Variable 5 b Out () Default (Integer 4 []) Source Public)}) h [(Var 5 a) (Var 5 b)] [(SubroutineCall 2 g () [(Var 5 a) (Var 5 b)])] Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) subroutines_02 [(= (Var 2 i) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (SubroutineCall 2 f () [(Var 2 i) (Var 2 j)]) (If (Compare (Var 2 i) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 j) NotEq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 g () [(Var 2 i) (Var 2 j)]) (If (Compare (Var 2 i) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 h () [(Var 2 i) (Var 2 j)]) (If (Compare (Var 2 i) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {subroutines_02: (Program (SymbolTable 2 {f: (Subroutine (SymbolTable 3 {a: (Variable 3 a In () Default (Integer 4 []) Source Public), b: (Variable 3 b Out () Default (Integer 4 []) Source Public)}) f [(Var 3 a) (Var 3 b)] [(= (Var 3 b) (BinOp (Var 3 a) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), g: (Subroutine (SymbolTable 4 {a: (Variable 4 a In () Default (Integer 4 []) Source Public), b: (Variable 4 b Out () Default (Integer 4 []) Source Public)}) g [(Var 4 a) (Var 4 b)] [(= (Var 4 b) (BinOp (Var 4 a) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])))] Source Public), h: (Subroutine (SymbolTable 5 {a: (Variable 5 a In () Default (Integer 4 []) Source Public), b: (Variable 5 b Out () Default (Integer 4 []) Source Public)}) h [(Var 5 a) (Var 5 b)] [(SubroutineCall 2 g () [(Var 5 a) (Var 5 b)])] Source Public), i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) subroutines_02 [] [(= (Var 2 i) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 j) (ConstantInteger 1 (Integer 4 []))) (SubroutineCall 2 f () [(Var 2 i) (Var 2 j)]) (If (Compare (Var 2 i) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 j) NotEq (ConstantInteger 2 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 g () [(Var 2 i) (Var 2 j)]) (If (Compare (Var 2 i) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (SubroutineCall 2 h () [(Var 2 i) (Var 2 j)]) (If (Compare (Var 2 i) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/asr-subroutines_04-a817e0c.json b/tests/reference/asr-subroutines_04-a817e0c.json index b1740676e4..ea607131e6 100644 --- a/tests/reference/asr-subroutines_04-a817e0c.json +++ b/tests/reference/asr-subroutines_04-a817e0c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-subroutines_04-a817e0c.stdout", - "stdout_hash": "bece60ec7f0a3397c57e22fb5b0f8f6f090538d1800ce442cd65bc79", + "stdout_hash": "ca6ea9e044007986370c204afb039b9e5ff4ded31f2a63aaf5898895", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-subroutines_04-a817e0c.stdout b/tests/reference/asr-subroutines_04-a817e0c.stdout index f77a923ba9..704f4e33fd 100644 --- a/tests/reference/asr-subroutines_04-a817e0c.stdout +++ b/tests/reference/asr-subroutines_04-a817e0c.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {print_it: (Program (SymbolTable 2 {print_int: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local (ConstantInteger 5 (Integer 4 [])) Default (Integer 4 []) Source Public)}) print_int [] [(Print () [(Var 3 a)])] Source Public)}) print_it [(SubroutineCall 2 print_int () [])])}) []) +(TranslationUnit (SymbolTable 1 {print_it: (Program (SymbolTable 2 {print_int: (Subroutine (SymbolTable 3 {a: (Variable 3 a Local (ConstantInteger 5 (Integer 4 [])) Default (Integer 4 []) Source Public)}) print_int [] [(Print () [(Var 3 a)])] Source Public)}) print_it [] [(SubroutineCall 2 print_int () [])])}) []) diff --git a/tests/reference/asr-types_01-a91206c.json b/tests/reference/asr-types_01-a91206c.json index 84411f0a80..4da99029bc 100644 --- a/tests/reference/asr-types_01-a91206c.json +++ b/tests/reference/asr-types_01-a91206c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-types_01-a91206c.stdout", - "stdout_hash": "cb1b423fb42d584af8b0abb56570037cfc9c71494033f45433bed4be", + "stdout_hash": "e2a17f141659ec7aa3f8065205acb492ab6ce3e0696d6aa12528ebb0", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-types_01-a91206c.stdout b/tests/reference/asr-types_01-a91206c.stdout index b0cbe726b4..35d14e902a 100644 --- a/tests/reference/asr-types_01-a91206c.stdout +++ b/tests/reference/asr-types_01-a91206c.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {types_01: (Program (SymbolTable 2 {r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_01 [(= (Var 2 r) (ConstantReal "1.0" (Real 4 []))) (= (Var 2 r) (ConstantReal "1.5" (Real 4 []))) (= (Var 2 r) (ConstantReal "1." (Real 4 [])))])}) []) +(TranslationUnit (SymbolTable 1 {types_01: (Program (SymbolTable 2 {r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_01 [] [(= (Var 2 r) (ConstantReal "1.0" (Real 4 []))) (= (Var 2 r) (ConstantReal "1.5" (Real 4 []))) (= (Var 2 r) (ConstantReal "1." (Real 4 [])))])}) []) diff --git a/tests/reference/asr-types_02-7a95ae7.json b/tests/reference/asr-types_02-7a95ae7.json index 7bf3c8e82e..90526236c3 100644 --- a/tests/reference/asr-types_02-7a95ae7.json +++ b/tests/reference/asr-types_02-7a95ae7.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-types_02-7a95ae7.stdout", - "stdout_hash": "77b8ba371c06d0090ba4dd8cf88296b729a4ac3d320a475ae06e1ad4", + "stdout_hash": "85d1d00eaef42fe2c36f29c01b1ced0c776e6928e67779b317efc11a", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-types_02-7a95ae7.stdout b/tests/reference/asr-types_02-7a95ae7.stdout index 7012f28acd..e5c89b76ae 100644 --- a/tests/reference/asr-types_02-7a95ae7.stdout +++ b/tests/reference/asr-types_02-7a95ae7.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {types_02: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_02 [(= (Var 2 i) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 r) (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 r) (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])))])}) []) +(TranslationUnit (SymbolTable 1 {types_02: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_02 [] [(= (Var 2 i) (ConstantInteger 1 (Integer 4 []))) (= (Var 2 r) (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 r) (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])))])}) []) diff --git a/tests/reference/asr-types_03-f0b782e.json b/tests/reference/asr-types_03-f0b782e.json index e0a967fc09..36c57d83b2 100644 --- a/tests/reference/asr-types_03-f0b782e.json +++ b/tests/reference/asr-types_03-f0b782e.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-types_03-f0b782e.stdout", - "stdout_hash": "9c50f979004c064644aedb5fbde8d22f7f063b27d3c1c8a8cdf76832", + "stdout_hash": "505ade3e3390ae6e667c94d590c2a751fb218ec5f516c037f26a1d50", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-types_03-f0b782e.stdout b/tests/reference/asr-types_03-f0b782e.stdout index 49c4fb35f5..bb0b86b4d2 100644 --- a/tests/reference/asr-types_03-f0b782e.stdout +++ b/tests/reference/asr-types_03-f0b782e.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {types_03: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_03 [(= (Var 2 r) (ConstantReal "1.5" (Real 4 []))) (Print () [(Var 2 r)]) (= (Var 2 i) (ImplicitCast (Var 2 r) RealToInteger (Integer 4 []))) (Print () [(Var 2 i)])])}) []) +(TranslationUnit (SymbolTable 1 {types_03: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_03 [] [(= (Var 2 r) (ConstantReal "1.5" (Real 4 []))) (Print () [(Var 2 r)]) (= (Var 2 i) (ImplicitCast (Var 2 r) RealToInteger (Integer 4 []))) (Print () [(Var 2 i)])])}) []) diff --git a/tests/reference/asr-types_04-056d321.json b/tests/reference/asr-types_04-056d321.json index b466c2c246..8d3810fa94 100644 --- a/tests/reference/asr-types_04-056d321.json +++ b/tests/reference/asr-types_04-056d321.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-types_04-056d321.stdout", - "stdout_hash": "d5a67472a99272e20050299c13cf0c7fa609b9d9ba88cd51fcaba54f", + "stdout_hash": "9d4b9482551506f2ff4a8c401370182f99f469b742d783ba35ba872c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-types_04-056d321.stdout b/tests/reference/asr-types_04-056d321.stdout index d1e21419cd..5d9ec7976d 100644 --- a/tests/reference/asr-types_04-056d321.stdout +++ b/tests/reference/asr-types_04-056d321.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {types_04: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public), x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) types_04 [(= (Var 2 r) (ConstantReal "1.5" (Real 4 []))) (= (Var 2 i) (ConstantInteger 2 (Integer 4 []))) (= (Var 2 x) (ImplicitCast (BinOp (Var 2 i) Mul (Var 2 i) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Mul (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Mul (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Mul (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 x) (ImplicitCast (BinOp (Var 2 i) Add (Var 2 i) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Add (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Add (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Add (Var 2 r) (Real 4 []))) (= (Var 2 x) (ImplicitCast (BinOp (Var 2 i) Sub (Var 2 i) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Sub (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Sub (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Sub (Var 2 r) (Real 4 []))) (= (Var 2 x) (ImplicitCast (BinOp (Var 2 i) Div (Var 2 i) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Div (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Div (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Div (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Real 4 [])))])}) []) +(TranslationUnit (SymbolTable 1 {types_04: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public), x: (Variable 2 x Local () Default (Real 4 []) Source Public)}) types_04 [] [(= (Var 2 r) (ConstantReal "1.5" (Real 4 []))) (= (Var 2 i) (ConstantInteger 2 (Integer 4 []))) (= (Var 2 x) (ImplicitCast (BinOp (Var 2 i) Mul (Var 2 i) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Mul (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Mul (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Mul (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 x) (ImplicitCast (BinOp (Var 2 i) Add (Var 2 i) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Add (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Add (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Add (Var 2 r) (Real 4 []))) (= (Var 2 x) (ImplicitCast (BinOp (Var 2 i) Sub (Var 2 i) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Sub (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Sub (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Sub (Var 2 r) (Real 4 []))) (= (Var 2 x) (ImplicitCast (BinOp (Var 2 i) Div (Var 2 i) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Div (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Div (Var 2 r) (Real 4 []))) (= (Var 2 x) (BinOp (Var 2 r) Div (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Real 4 [])))])}) []) diff --git a/tests/reference/asr-types_05-fa1bde9.json b/tests/reference/asr-types_05-fa1bde9.json index dc825b36e5..201f78fd17 100644 --- a/tests/reference/asr-types_05-fa1bde9.json +++ b/tests/reference/asr-types_05-fa1bde9.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-types_05-fa1bde9.stdout", - "stdout_hash": "41083273ed75fefe13f71b12ff84ff60be0c16dcfa53e4f3523f9a5f", + "stdout_hash": "dfaead606e187571067e1f387ae715ed09b587a02cf7f5023625b049", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-types_05-fa1bde9.stdout b/tests/reference/asr-types_05-fa1bde9.stdout index 7b6f1672b2..0c7191d554 100644 --- a/tests/reference/asr-types_05-fa1bde9.stdout +++ b/tests/reference/asr-types_05-fa1bde9.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {types_05: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_05 [(= (Var 2 r) (BinOp (ConstantReal "1." (Real 4 [])) Mul (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 r) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (ConstantReal "1." (Real 4 [])) (Real 4 []))) (= (Var 2 r) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (BinOp (ImplicitCast (ConstantInteger 3 (Integer 4 [])) IntegerToReal (Real 4 [])) Add (ConstantReal "1." (Real 4 [])) (Real 4 [])) (Real 4 []))) (= (Var 2 r) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (BinOp (ConstantReal "3." (Real 4 [])) Sub (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Real 4 []))) (= (Var 2 r) (ImplicitCast (BinOp (ConstantInteger 1 (Integer 4 [])) Div (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 r) (BinOp (ConstantReal "1." (Real 4 [])) Div (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 r) (BinOp (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) Div (ConstantReal "2." (Real 4 [])) (Real 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ConstantReal "1." (Real 4 [])) Mul (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (ConstantReal "1." (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (BinOp (ImplicitCast (ConstantInteger 3 (Integer 4 [])) IntegerToReal (Real 4 [])) Add (ConstantReal "1." (Real 4 [])) (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (BinOp (ConstantReal "3." (Real 4 [])) Sub (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Div (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ConstantReal "1." (Real 4 [])) Div (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) Div (ConstantReal "2." (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 [])))])}) []) +(TranslationUnit (SymbolTable 1 {types_05: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_05 [] [(= (Var 2 r) (BinOp (ConstantReal "1." (Real 4 [])) Mul (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 r) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (ConstantReal "1." (Real 4 [])) (Real 4 []))) (= (Var 2 r) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (BinOp (ImplicitCast (ConstantInteger 3 (Integer 4 [])) IntegerToReal (Real 4 [])) Add (ConstantReal "1." (Real 4 [])) (Real 4 [])) (Real 4 []))) (= (Var 2 r) (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (BinOp (ConstantReal "3." (Real 4 [])) Sub (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Real 4 []))) (= (Var 2 r) (ImplicitCast (BinOp (ConstantInteger 1 (Integer 4 [])) Div (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 r) (BinOp (ConstantReal "1." (Real 4 [])) Div (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 []))) (= (Var 2 r) (BinOp (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) Div (ConstantReal "2." (Real 4 [])) (Real 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ConstantReal "1." (Real 4 [])) Mul (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (ConstantReal "1." (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (BinOp (ImplicitCast (ConstantInteger 3 (Integer 4 [])) IntegerToReal (Real 4 [])) Add (ConstantReal "1." (Real 4 [])) (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) Mul (BinOp (ConstantReal "3." (Real 4 [])) Sub (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Div (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ConstantReal "1." (Real 4 [])) Div (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 []))) (= (Var 2 i) (ImplicitCast (BinOp (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) Div (ConstantReal "2." (Real 4 [])) (Real 4 [])) RealToInteger (Integer 4 [])))])}) []) diff --git a/tests/reference/asr-types_06-58f9b18.json b/tests/reference/asr-types_06-58f9b18.json index 64c30e128a..ed27f15d3e 100644 --- a/tests/reference/asr-types_06-58f9b18.json +++ b/tests/reference/asr-types_06-58f9b18.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-types_06-58f9b18.stdout", - "stdout_hash": "85f56f453172f837e04e26aaa760a36ded5bc150782fbd2b5ec65348", + "stdout_hash": "a05333176d3f23f65072fdd5af2a1c2e4a7c4e3b3670ad596c189391", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-types_06-58f9b18.stdout b/tests/reference/asr-types_06-58f9b18.stdout index 23e634d4e4..a71790cf84 100644 --- a/tests/reference/asr-types_06-58f9b18.stdout +++ b/tests/reference/asr-types_06-58f9b18.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {types_06: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_06 [(= (Var 2 r) (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 i) (ConstantInteger 2 (Integer 4 []))) (If (Compare (Var 2 i) Lt (Var 2 i) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Lt (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Lt (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Lt (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 i) Gt (Var 2 i) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Gt (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Gt (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Gt (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 i) NotEq (Var 2 i) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) NotEq (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) NotEq (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) NotEq (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) LtE (Var 2 i) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) LtE (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) LtE (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) IntegerToReal (Real 4 [])) LtE (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 i) GtE (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) GtE (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) GtE (ImplicitCast (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) GtE (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 i) Eq (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Eq (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Eq (ImplicitCast (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Eq (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {types_06: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), r: (Variable 2 r Local () Default (Real 4 []) Source Public)}) types_06 [] [(= (Var 2 r) (ImplicitCast (ConstantInteger 2 (Integer 4 [])) IntegerToReal (Real 4 []))) (= (Var 2 i) (ConstantInteger 2 (Integer 4 []))) (If (Compare (Var 2 i) Lt (Var 2 i) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Lt (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Lt (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Lt (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 i) Gt (Var 2 i) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Gt (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Gt (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Gt (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 i) NotEq (Var 2 i) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) NotEq (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) NotEq (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) NotEq (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) LtE (Var 2 i) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) LtE (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) LtE (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) IntegerToReal (Real 4 [])) LtE (Var 2 r) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 i) GtE (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) GtE (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) GtE (ImplicitCast (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) GtE (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 i) Eq (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Eq (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (Var 2 r) Eq (ImplicitCast (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) IntegerToReal (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (If (Compare (ImplicitCast (Var 2 i) IntegerToReal (Real 4 [])) Eq (BinOp (Var 2 r) Add (ImplicitCast (ConstantInteger 1 (Integer 4 [])) IntegerToReal (Real 4 [])) (Real 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/ast-allocate_01-08346a8.json b/tests/reference/ast-allocate_01-08346a8.json new file mode 100644 index 0000000000..0be6baa142 --- /dev/null +++ b/tests/reference/ast-allocate_01-08346a8.json @@ -0,0 +1,13 @@ +{ + "basename": "ast-allocate_01-08346a8", + "cmd": "lfortran --show-ast --no-color {infile} -o {outfile}", + "infile": "tests/../integration_tests/allocate_01.f90", + "infile_hash": "c00859de3927508b3835d0243cf2348621ba293389e3b69ff53725ef", + "outfile": null, + "outfile_hash": null, + "stdout": "ast-allocate_01-08346a8.stdout", + "stdout_hash": "526ab6641ce792ab57352b757a79370d05621e8875839a4543a25daa", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/ast-allocate_01-08346a8.stdout b/tests/reference/ast-allocate_01-08346a8.stdout new file mode 100644 index 0000000000..fb5adbe3b9 --- /dev/null +++ b/tests/reference/ast-allocate_01-08346a8.stdout @@ -0,0 +1 @@ +(TranslationUnit [(Program allocate_01 [] [(Declaration [(a "real" () [] [(() ())] [(Attribute allocatable [] [])] ()) (b "real" () [] [(() ()) (() ())] [(Attribute allocatable [] [])] ()) (c "real" () [] [(() ()) (() ()) (() ())] [(Attribute allocatable [] [])] ())]) (Declaration [(n "integer" () [] [] [] ()) (ierr "integer" () [] [] [] ())])] [(= n 10) (Allocate [(() (FuncCallOrArray a [(() 5 ())] []) ())] []) (Allocate [(() (FuncCallOrArray b [(() n ()) (() n ())] []) ()) (() (FuncCallOrArray c [(() n ()) (() 5 ()) (() n ())] []) ())] [(stat ierr)]) (Deallocate [(() a ()) (() c ())])] [])]) diff --git a/tests/reference/ast-arrays_06-9c351b7.json b/tests/reference/ast-arrays_06-9c351b7.json new file mode 100644 index 0000000000..057539f54e --- /dev/null +++ b/tests/reference/ast-arrays_06-9c351b7.json @@ -0,0 +1,13 @@ +{ + "basename": "ast-arrays_06-9c351b7", + "cmd": "lfortran --show-ast --no-color {infile} -o {outfile}", + "infile": "tests/../integration_tests/arrays_06.f90", + "infile_hash": "b843d06bb0793eb2f8c46458c69cfdf97cf75970150d513a7d7156f0", + "outfile": null, + "outfile_hash": null, + "stdout": "ast-arrays_06-9c351b7.stdout", + "stdout_hash": "ec817393e12bcca78339c984e137c23e68ef65c017f38dddbf94bb2f", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/ast-arrays_06-9c351b7.stdout b/tests/reference/ast-arrays_06-9c351b7.stdout new file mode 100644 index 0000000000..d517035429 --- /dev/null +++ b/tests/reference/ast-arrays_06-9c351b7.stdout @@ -0,0 +1 @@ +(TranslationUnit [(Program arrays_06 [] [(Declaration [(x "real" () [] [] [(Attribute dimension [] [(1 6)])] ())]) (Declaration [(i "integer" () [] [] [] ())])] [(= x (ArrayInitializer [(* i 2)])) (Print () [x]) (= x (ArrayInitializer [(+ i 1)])) (Print () [x]) (= x (ArrayInitializer [(+ i 1)])) (Print () [x]) (= x (ArrayInitializer [(* 2 i)])) (Print () [x])] [])]) diff --git a/tests/reference/asr-associate_01-24b5a9e.json b/tests/reference/ast-associate_01-4a4ac5c.json similarity index 52% rename from tests/reference/asr-associate_01-24b5a9e.json rename to tests/reference/ast-associate_01-4a4ac5c.json index 33be4bbdef..0ac6809367 100644 --- a/tests/reference/asr-associate_01-24b5a9e.json +++ b/tests/reference/ast-associate_01-4a4ac5c.json @@ -1,12 +1,12 @@ { - "basename": "asr-associate_01-24b5a9e", - "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", + "basename": "ast-associate_01-4a4ac5c", + "cmd": "lfortran --show-ast --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/associate_01.f90", "infile_hash": "2c30bae981ba0fa05fb7f5715aeb34ee5a742af7c732b17902ba4ae0", "outfile": null, "outfile_hash": null, - "stdout": "asr-associate_01-24b5a9e.stdout", - "stdout_hash": "280335b90d0ea9eed4544cabd6496605ae32912a77b80248153e6cfb", + "stdout": "ast-associate_01-4a4ac5c.stdout", + "stdout_hash": "426a4ea43297c9f54b4109663e75f793fd942ded3459e581cb1ee553", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-associate_01-4a4ac5c.stdout b/tests/reference/ast-associate_01-4a4ac5c.stdout new file mode 100644 index 0000000000..56011041f8 --- /dev/null +++ b/tests/reference/ast-associate_01-4a4ac5c.stdout @@ -0,0 +1 @@ +(TranslationUnit [(Program associate_01 [] [(Declaration [(a "real" () [] [(() ())] [(Attribute allocatable [] [])] ()) (b "real" () [] [(() ()) (() ())] [(Attribute allocatable [] [])] ()) (c "real" () [] [(() ()) (() ()) (() ())] [(Attribute allocatable [] [])] ())]) (Declaration [(x "real" () [] [(() ())] [(Attribute pointer [] [])] ()) (y "real" () [] [(() ()) (() ()) (() ())] [(Attribute pointer [] [])] ())]) (Declaration [(a_1 "real" () [] [] [] ()) (c_234 "real" () [] [] [] ())]) (Declaration [(n "integer" () [] [] [] ())])] [(= n 10) (Allocate [(() (FuncCallOrArray a [(() 5 ())] []) ())] []) (Allocate [(() (FuncCallOrArray b [(() n ()) (() n ())] []) ()) (() (FuncCallOrArray c [(() n ()) (() 5 ()) (() n ())] []) ())] []) (Print () []) (= a_1 (FuncCallOrArray a [(() 1 ())] [])) (= c_234 (FuncCallOrArray c [(() 2 ()) (() 3 ()) (() 4 ())] [])) (Print () [a_1]) (Print () [c_234])] [])]) diff --git a/tests/reference/ast-interface_01-587eedf.json b/tests/reference/ast-interface_01-587eedf.json index 0db79ae65f..1b4d19a596 100644 --- a/tests/reference/ast-interface_01-587eedf.json +++ b/tests/reference/ast-interface_01-587eedf.json @@ -2,11 +2,11 @@ "basename": "ast-interface_01-587eedf", "cmd": "lfortran --show-ast --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/interface_01.f90", - "infile_hash": "fc4522469f3b6ff802e3198f034497a8c7b11b5ec051dc93d62b9ab5", + "infile_hash": "56828a66265782f7acd20520a5d25ac6246d6d44dfb8fa758507ed63", "outfile": null, "outfile_hash": null, "stdout": "ast-interface_01-587eedf.stdout", - "stdout_hash": "c19b49ad767832b2807fa438f83c99c3b7df8ce07e80d177bd30e7e3", + "stdout_hash": "41b37270a13b043261546731c50d219ed12ca1e05c8dac41510d5029", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-interface_01-587eedf.stdout b/tests/reference/ast-interface_01-587eedf.stdout index c0cded62fc..7b0eaaa172 100644 --- a/tests/reference/ast-interface_01-587eedf.stdout +++ b/tests/reference/ast-interface_01-587eedf.stdout @@ -1 +1 @@ -(TranslationUnit [(Module interface_01_mod [] [(Interface (InterfaceHeader2 a) [(InterfaceModuleProcedure [a1]) (InterfaceModuleProcedure [a2])])] [(Subroutine a1 [(a)] [] [(Declaration [(a "integer" () [] [] [(Attribute intent [(inout)] [])] ())])] [(= a (+ a 1))] []) (Subroutine a2 [(a)] [] [(Declaration [(a "real" () [] [] [(Attribute intent [(inout)] [])] ())])] [(= a (+ a 1))] [])]) (Program interface_01 [(Use interface_01_mod [(UseSymbol a ())])] [(Declaration [(i "integer" () [] [] [] ())]) (Declaration [(r "real" () [] [] [] ())])] [(= i 5) (SubroutineCall a [(() i ())] []) (If (/= i 6) [(ErrorStop ())] []) (= r 6) (SubroutineCall a [(() r ())] []) (If (/= r 7) [(ErrorStop ())] [])] [])]) +(TranslationUnit [(Module interface_01_mod [] [(Interface (InterfaceHeader2 a) [(InterfaceModuleProcedure [a1]) (InterfaceModuleProcedure [a2])])] [(Subroutine a1 [(a)] [] [(Declaration [(a "integer" () [] [] [(Attribute intent [(inout)] [])] ())])] [(= a (+ a 1))] []) (Subroutine a2 [(a)] [] [(Declaration [(a "real" () [] [] [(Attribute intent [(inout)] [])] ())])] [(= a (+ a 1))] [])]) (Program interface_01 [(Use interface_01_mod [(UseSymbol a ())])] [(Declaration [(i "integer" () [] [] [] ())]) (Declaration [(r "real" () [] [] [] ())])] [(= i 5) (SubroutineCall a [(() i ())] []) (If (/= i 6) [(ErrorStop ())] []) (= r 6) (SubroutineCall a [(() r ())] []) (If (/= r 7) [(ErrorStop ())] []) (= i 7) (SubroutineCall a [(() i ())] []) (If (/= i 8) [(ErrorStop ())] [])] [])]) diff --git a/tests/reference/ast-lfortran_intrinsic_math-7438bd6.json b/tests/reference/ast-lfortran_intrinsic_math-7438bd6.json index 5006934a40..a77948cf7a 100644 --- a/tests/reference/ast-lfortran_intrinsic_math-7438bd6.json +++ b/tests/reference/ast-lfortran_intrinsic_math-7438bd6.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "ast-lfortran_intrinsic_math-7438bd6.stdout", - "stdout_hash": "1506331820f73cbc2e49810f566042261e5fe5cd75a14419ab82e6e4", + "stdout_hash": "4a5e2cd4c7f85e55af4705eee65c00412f92dc1ce444ab734fc60f92", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-lfortran_intrinsic_math-7438bd6.stdout b/tests/reference/ast-lfortran_intrinsic_math-7438bd6.stdout index 803075722e..3853a3b000 100644 --- a/tests/reference/ast-lfortran_intrinsic_math-7438bd6.stdout +++ b/tests/reference/ast-lfortran_intrinsic_math-7438bd6.stdout @@ -1 +1 @@ -(TranslationUnit [(Module lfortran_intrinsic_math [] [(Interface (InterfaceHeader2 abs) [(InterfaceModuleProcedure [sabs dabs cabs zabs])]) (Interface (InterfaceHeader2 sqrt) [(InterfaceModuleProcedure [ssqrt dsqrt])]) (Interface (InterfaceHeader2 sin) [(InterfaceModuleProcedure [ssin dsin csin zsin])]) (Interface (InterfaceHeader2 cos) [(InterfaceModuleProcedure [scos dcos ccos zcos])]) (Interface (InterfaceHeader2 tan) [(InterfaceModuleProcedure [stan dtan ctan ztan])]) (Interface (InterfaceHeader2 sinh) [(InterfaceModuleProcedure [ssinh dsinh csinh zsinh])]) (Interface (InterfaceHeader2 cosh) [(InterfaceModuleProcedure [scosh dcosh ccosh zcosh])]) (Interface (InterfaceHeader2 tanh) [(InterfaceModuleProcedure [stanh dtanh ctanh ztanh])]) (Interface (InterfaceHeader2 asin) [(InterfaceModuleProcedure [sasin dasin casin zasin])]) (Interface (InterfaceHeader2 acos) [(InterfaceModuleProcedure [sacos dacos cacos zacos])]) (Interface (InterfaceHeader2 atan) [(InterfaceModuleProcedure [satan datan catan zatan])]) (Interface (InterfaceHeader2 asinh) [(InterfaceModuleProcedure [sasinh dasinh casinh zasinh])]) (Interface (InterfaceHeader2 acosh) [(InterfaceModuleProcedure [sacosh dacosh cacosh zacosh])]) (Interface (InterfaceHeader2 atanh) [(InterfaceModuleProcedure [satanh datanh catanh zatanh])])] [(Function sabs [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())])] [(If (>= x 0) [(= r x)] [(= r (u- x))])] []) (Function dabs [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())])] [(If (>= x 0) [(= r x)] [(= r (u- x))])] []) (Function cabs [(x)] "real" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())])] [(= r (FuncCallOrArray sqrt [(() (+ (** (FuncCallOrArray real [(() x ()) (() sp ())] []) 2) (** (FuncCallOrArray aimag [(() x ())] []) 2)) ())] []))] []) (Function zabs [(x)] "real" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())])] [(= r (FuncCallOrArray sqrt [(() (+ (** (FuncCallOrArray real [(() x ()) (() dp ())] []) 2) (** (FuncCallOrArray aimag [(() x ())] []) 2)) ())] []))] []) (Function ssqrt [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())])] [(If (>= x 0) [(= r (** x (/ (Real "1._sp") 2)))] [(ErrorStop (Str "sqrt(x) for x < 0 is not allowed"))])] []) (Function dsqrt [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())])] [(If (>= x 0) [(= r (** x (/ (Real "1._dp") 2)))] [(ErrorStop (Str "sqrt(x) for x < 0 is not allowed"))])] []) (Function ssin [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ssin [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ssin [(() x ())] []))] []) (Function dsin [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dsin [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dsin [(() x ())] []))] []) (Function csin [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_csin [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_csin [(() x ())] []))] []) (Function zsin [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zsin [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zsin [(() x ())] []))] []) (Function scos [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_scos [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_scos [(() x ())] []))] []) (Function dcos [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dcos [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dcos [(() x ())] []))] []) (Function ccos [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ccos [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ccos [(() x ())] []))] []) (Function zcos [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zcos [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zcos [(() x ())] []))] []) (Function stan [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_stan [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_stan [(() x ())] []))] []) (Function dtan [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dtan [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dtan [(() x ())] []))] []) (Function ctan [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ctan [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ctan [(() x ())] []))] []) (Function ztan [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ztan [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ztan [(() x ())] []))] []) (Function ssinh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ssinh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ssinh [(() x ())] []))] []) (Function dsinh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dsinh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dsinh [(() x ())] []))] []) (Function csinh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_csinh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_csinh [(() x ())] []))] []) (Function zsinh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zsinh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zsinh [(() x ())] []))] []) (Function scosh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_scosh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_scosh [(() x ())] []))] []) (Function dcosh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dcosh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dcosh [(() x ())] []))] []) (Function ccosh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ccosh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ccosh [(() x ())] []))] []) (Function zcosh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zcosh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zcosh [(() x ())] []))] []) (Function stanh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_stanh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_stanh [(() x ())] []))] []) (Function dtanh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dtanh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dtanh [(() x ())] []))] []) (Function ctanh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ctanh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ctanh [(() x ())] []))] []) (Function ztanh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ztanh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ztanh [(() x ())] []))] []) (Function sasin [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_sasin [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_sasin [(() x ())] []))] []) (Function dasin [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dasin [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dasin [(() x ())] []))] []) (Function casin [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_casin [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_casin [(() x ())] []))] []) (Function zasin [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zasin [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zasin [(() x ())] []))] []) (Function sacos [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_sacos [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_sacos [(() x ())] []))] []) (Function dacos [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dacos [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dacos [(() x ())] []))] []) (Function cacos [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_cacos [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_cacos [(() x ())] []))] []) (Function zacos [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zacos [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zacos [(() x ())] []))] []) (Function satan [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_satan [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_satan [(() x ())] []))] []) (Function datan [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_datan [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_datan [(() x ())] []))] []) (Function catan [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_catan [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_catan [(() x ())] []))] []) (Function zatan [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zatan [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zatan [(() x ())] []))] []) (Function sasinh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_sasinh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_sasinh [(() x ())] []))] []) (Function dasinh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dasinh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dasinh [(() x ())] []))] []) (Function casinh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_casinh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_casinh [(() x ())] []))] []) (Function zasinh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zasinh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zasinh [(() x ())] []))] []) (Function sacosh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_sacosh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_sacosh [(() x ())] []))] []) (Function dacosh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dacosh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dacosh [(() x ())] []))] []) (Function cacosh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_cacosh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_cacosh [(() x ())] []))] []) (Function zacosh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zacosh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zacosh [(() x ())] []))] []) (Function satanh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_satanh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_satanh [(() x ())] []))] []) (Function datanh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_datanh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_datanh [(() x ())] []))] []) (Function catanh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_catanh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_catanh [(() x ())] []))] []) (Function zatanh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zatanh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zatanh [(() x ())] []))] [])])]) +(TranslationUnit [(Module lfortran_intrinsic_math [(Use iso_fortran_env [(UseSymbol real32 sp) (UseSymbol real64 dp)]) (Use iso_c_binding [(UseSymbol c_float ()) (UseSymbol c_double ())])] [(Interface (InterfaceHeader2 abs) [(InterfaceModuleProcedure [sabs dabs cabs zabs])]) (Interface (InterfaceHeader2 sqrt) [(InterfaceModuleProcedure [ssqrt dsqrt])]) (Interface (InterfaceHeader2 sin) [(InterfaceModuleProcedure [ssin dsin csin zsin])]) (Interface (InterfaceHeader2 cos) [(InterfaceModuleProcedure [scos dcos ccos zcos])]) (Interface (InterfaceHeader2 tan) [(InterfaceModuleProcedure [stan dtan ctan ztan])]) (Interface (InterfaceHeader2 sinh) [(InterfaceModuleProcedure [ssinh dsinh csinh zsinh])]) (Interface (InterfaceHeader2 cosh) [(InterfaceModuleProcedure [scosh dcosh ccosh zcosh])]) (Interface (InterfaceHeader2 tanh) [(InterfaceModuleProcedure [stanh dtanh ctanh ztanh])]) (Interface (InterfaceHeader2 asin) [(InterfaceModuleProcedure [sasin dasin casin zasin])]) (Interface (InterfaceHeader2 acos) [(InterfaceModuleProcedure [sacos dacos cacos zacos])]) (Interface (InterfaceHeader2 atan) [(InterfaceModuleProcedure [satan datan catan zatan])]) (Interface (InterfaceHeader2 asinh) [(InterfaceModuleProcedure [sasinh dasinh casinh zasinh])]) (Interface (InterfaceHeader2 acosh) [(InterfaceModuleProcedure [sacosh dacosh cacosh zacosh])]) (Interface (InterfaceHeader2 atanh) [(InterfaceModuleProcedure [satanh datanh catanh zatanh])])] [(Function sabs [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())])] [(If (>= x 0) [(= r x)] [(= r (u- x))])] []) (Function dabs [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())])] [(If (>= x 0) [(= r x)] [(= r (u- x))])] []) (Function cabs [(x)] "real" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())])] [(= r (FuncCallOrArray sqrt [(() (+ (** (FuncCallOrArray real [(() x ()) (() sp ())] []) 2) (** (FuncCallOrArray aimag [(() x ())] []) 2)) ())] []))] []) (Function zabs [(x)] "real" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())])] [(= r (FuncCallOrArray sqrt [(() (+ (** (FuncCallOrArray real [(() x ()) (() dp ())] []) 2) (** (FuncCallOrArray aimag [(() x ())] []) 2)) ())] []))] []) (Function ssqrt [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())])] [(If (>= x 0) [(= r (** x (/ (Real "1._sp") 2)))] [(ErrorStop (Str "sqrt(x) for x < 0 is not allowed"))])] []) (Function dsqrt [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())])] [(If (>= x 0) [(= r (** x (/ (Real "1._dp") 2)))] [(ErrorStop (Str "sqrt(x) for x < 0 is not allowed"))])] []) (Function ssin [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ssin [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ssin [(() x ())] []))] []) (Function dsin [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dsin [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dsin [(() x ())] []))] []) (Function csin [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_csin [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_csin [(() x ())] []))] []) (Function zsin [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zsin [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zsin [(() x ())] []))] []) (Function scos [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_scos [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_scos [(() x ())] []))] []) (Function dcos [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dcos [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dcos [(() x ())] []))] []) (Function ccos [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ccos [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ccos [(() x ())] []))] []) (Function zcos [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zcos [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zcos [(() x ())] []))] []) (Function stan [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_stan [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_stan [(() x ())] []))] []) (Function dtan [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dtan [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dtan [(() x ())] []))] []) (Function ctan [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ctan [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ctan [(() x ())] []))] []) (Function ztan [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ztan [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ztan [(() x ())] []))] []) (Function ssinh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ssinh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ssinh [(() x ())] []))] []) (Function dsinh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dsinh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dsinh [(() x ())] []))] []) (Function csinh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_csinh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_csinh [(() x ())] []))] []) (Function zsinh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zsinh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zsinh [(() x ())] []))] []) (Function scosh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_scosh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_scosh [(() x ())] []))] []) (Function dcosh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dcosh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dcosh [(() x ())] []))] []) (Function ccosh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ccosh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ccosh [(() x ())] []))] []) (Function zcosh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zcosh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zcosh [(() x ())] []))] []) (Function stanh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_stanh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_stanh [(() x ())] []))] []) (Function dtanh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dtanh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dtanh [(() x ())] []))] []) (Function ctanh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ctanh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ctanh [(() x ())] []))] []) (Function ztanh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_ztanh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_ztanh [(() x ())] []))] []) (Function sasin [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_sasin [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_sasin [(() x ())] []))] []) (Function dasin [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dasin [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dasin [(() x ())] []))] []) (Function casin [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_casin [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_casin [(() x ())] []))] []) (Function zasin [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zasin [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zasin [(() x ())] []))] []) (Function sacos [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_sacos [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_sacos [(() x ())] []))] []) (Function dacos [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dacos [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dacos [(() x ())] []))] []) (Function cacos [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_cacos [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_cacos [(() x ())] []))] []) (Function zacos [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zacos [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zacos [(() x ())] []))] []) (Function satan [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_satan [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_satan [(() x ())] []))] []) (Function datan [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_datan [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_datan [(() x ())] []))] []) (Function catan [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_catan [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_catan [(() x ())] []))] []) (Function zatan [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zatan [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zatan [(() x ())] []))] []) (Function sasinh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_sasinh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_sasinh [(() x ())] []))] []) (Function dasinh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dasinh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dasinh [(() x ())] []))] []) (Function casinh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_casinh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_casinh [(() x ())] []))] []) (Function zasinh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zasinh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zasinh [(() x ())] []))] []) (Function sacosh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_sacosh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_sacosh [(() x ())] []))] []) (Function dacosh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_dacosh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_dacosh [(() x ())] []))] []) (Function cacosh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_cacosh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_cacosh [(() x ())] []))] []) (Function zacosh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zacosh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zacosh [(() x ())] []))] []) (Function satanh [(x)] "real" r () [] [(Declaration [(x "real" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_satanh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_satanh [(() x ())] []))] []) (Function datanh [(x)] "real" r () [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_datanh [(x)] "real" () () [] [(Declaration [(x "real" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_datanh [(() x ())] []))] []) (Function catanh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() sp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_catanh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_float Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_catanh [(() x ())] []))] []) (Function zatanh [(x)] "complex" r () [] [(Declaration [(x "complex" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Interface (InterfaceHeader1) [(InterfaceProc (Function c_zatanh [(x)] "complex" () () [] [(Declaration [(x "complex" () [(() c_double Value)] [] [(Attribute intent [(in)] []) (Attribute value [] [])] ())])] [] []))])] [(= r (FuncCallOrArray c_zatanh [(() x ())] []))] [])])]) diff --git a/tests/reference/ast-modules_01-da63075.json b/tests/reference/ast-modules_01-da63075.json index 7d8c04ac79..eaf1d180bd 100644 --- a/tests/reference/ast-modules_01-da63075.json +++ b/tests/reference/ast-modules_01-da63075.json @@ -2,11 +2,11 @@ "basename": "ast-modules_01-da63075", "cmd": "lfortran --show-ast --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/modules_01.f90", - "infile_hash": "697383eb5d15cbcf71af84f8421bbe2d4e7a7d094c24b90d5b0c4678", + "infile_hash": "17c761eb72726e0dde59f2b21f98f2402d783613834e927c49047534", "outfile": null, "outfile_hash": null, "stdout": "ast-modules_01-da63075.stdout", - "stdout_hash": "ba4951224b696371230166c1b64432ffebf02fa2f013057d123817cf", + "stdout_hash": "af4fb92ed44fa27aa54f117d394324c2495433e53cc13009c180ff49", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-modules_01-da63075.stdout b/tests/reference/ast-modules_01-da63075.stdout index 059ae4824d..834638f6f5 100644 --- a/tests/reference/ast-modules_01-da63075.stdout +++ b/tests/reference/ast-modules_01-da63075.stdout @@ -1 +1 @@ -(TranslationUnit [(Module a [] [] [(Subroutine b [] [] [] [(Print () [(Str "b()")])] [])]) (Program modules_01 [(Use a [(UseSymbol b ())])] [] [(SubroutineCall b [] [])] [])]) +(TranslationUnit [(Module a_01 [] [] [(Subroutine b [] [] [] [(Print () [(Str "b()")])] [])]) (Program modules_01 [(Use a_01 [(UseSymbol b ())])] [] [(SubroutineCall b [] [])] [])]) diff --git a/tests/reference/ast-modules_02-dc19c13.json b/tests/reference/ast-modules_02-dc19c13.json index 24512c4026..1dbe669d91 100644 --- a/tests/reference/ast-modules_02-dc19c13.json +++ b/tests/reference/ast-modules_02-dc19c13.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "ast-modules_02-dc19c13.stdout", - "stdout_hash": "1fa00afd39d2d662765a0ba513da83e468da7624ffdc55ea48e1b2ed", + "stdout_hash": "b5edb5bd3ab3d54e637daa6d60b5e13ea904e217ffa72ec6055714d5", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-modules_02-dc19c13.stdout b/tests/reference/ast-modules_02-dc19c13.stdout index ce531337a5..e01c6d0d49 100644 --- a/tests/reference/ast-modules_02-dc19c13.stdout +++ b/tests/reference/ast-modules_02-dc19c13.stdout @@ -1 +1 @@ -(TranslationUnit [(Module random [] [(Declaration [(() () () [] [] [(Attribute private [] [])] ())]) (Declaration [(randn () () [] [] [(Attribute public [] [])] ()) (rand_gamma () () [] [] [(Attribute public [] [])] ())]) (Interface (InterfaceHeader2 randn) [(InterfaceModuleProcedure [randn_scalar]) (InterfaceModuleProcedure [randn_vector]) (InterfaceModuleProcedure [randn_matrix]) (InterfaceModuleProcedure [randn_vector_n])]) (Interface (InterfaceHeader2 rand_gamma) [(InterfaceModuleProcedure [rand_gamma_scalar]) (InterfaceModuleProcedure [rand_gamma_vector]) (InterfaceModuleProcedure [rand_gamma_matrix]) (InterfaceModuleProcedure [rand_gamma_vector_n])])] [(Subroutine randn_scalar [(x)] [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(out)] [])] ())]) (Declaration [(first "logical" () [] [] [(Attribute save [] [])] (Logical .true.))]) (Declaration [(u "real" () [(() dp Value)] [(1 2)] [(Attribute save [] [])] ())]) (Declaration [(r2 "real" () [(() dp Value)] [] [] ())])] [(If first [(DoLoop () () () () [(SubroutineCall random_number [(() u ())] []) (= u (- (* 2 u) 1)) (= r2 (FuncCallOrArray sum [(() (** u 2) ())] [])) (If (BoolOp (< r2 1) And (> r2 0)) [(Exit)] [])]) (= u (* u (FuncCallOrArray sqrt [(() (/ (* (u- 2) (FuncCallOrArray log [(() r2 ())] [])) r2) ())] []))) (= x (FuncCallOrArray u [(() 1 ())] []))] [(= x (FuncCallOrArray u [(() 2 ())] []))]) (= first (not first))] []) (Subroutine randn_vector_n [(n) (x)] [] [(Declaration [(n "integer" () [] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [(1 n)] [(Attribute intent [(out)] [])] ())]) (Declaration [(i "integer" () [] [] [] ())])] [(DoLoop i 1 (FuncCallOrArray size [(() x ())] []) () [(SubroutineCall randn [(() (FuncCallOrArray x [(() i ())] []) ())] [])])] []) (Subroutine randn_vector [(x)] [] [(Declaration [(x "real" () [(() dp Value)] [(() ())] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall randn_vector_n [(() (FuncCallOrArray size [(() x ())] []) ()) (() x ())] [])] []) (Subroutine randn_matrix [(x)] [] [(Declaration [(x "real" () [(() dp Value)] [(() ()) (() ())] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall randn_vector_n [(() (FuncCallOrArray size [(() x ())] []) ()) (() x ())] [])] []) (Subroutine rand_gamma0 [(a) (first) (fn_val)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(first "logical" () [] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(fn_val "real" () [(() dp Value)] [] [(Attribute intent [(out)] [])] ())]) (Declaration [(c "real" () [(() dp Value)] [] [(Attribute save [] [])] ()) (d "real" () [(() dp Value)] [] [(Attribute save [] [])] ())]) (Declaration [(U "real" () [(() dp Value)] [] [] ()) (v "real" () [(() dp Value)] [] [] ()) (x "real" () [(() dp Value)] [] [] ())])] [(If (< a 1) [(SubroutineCall stop_error [(() (Str "Shape parameter must be >= 1") ())] [])] []) (If first [(= d (- a (/ (Real "1._dp") 3))) (= c (/ 1 (FuncCallOrArray sqrt [(() (* 9 d) ())] [])))] []) (DoLoop () () () () [(DoLoop () () () () [(SubroutineCall randn [(() x ())] []) (= v (** (+ 1 (* c x)) 3)) (If (> v 0) [(Exit)] [])]) (SubroutineCall random_number [(() U ())] []) (If (< U (- 1 (* (Real "0.0331_dp") (** x 4)))) [(= fn_val (* d v)) (Exit)] [(If (< (FuncCallOrArray log [(() U ())] []) (+ (/ (** x 2) 2) (* d (+ (- 1 v) (FuncCallOrArray log [(() v ())] []))))) [(= fn_val (* d v)) (Exit)] [])])])] []) (Subroutine rand_gamma_scalar [(a) (x)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall rand_gamma0 [(() a ()) (() (Logical .true.) ()) (() x ())] [])] []) (Subroutine rand_gamma_vector_n [(a) (n) (x)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(n "integer" () [] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [(1 n)] [(Attribute intent [(out)] [])] ())]) (Declaration [(i "integer" () [] [] [] ())])] [(SubroutineCall rand_gamma0 [(() a ()) (() (Logical .true.) ()) (() (FuncCallOrArray x [(() 1 ())] []) ())] []) (DoLoop i 2 (FuncCallOrArray size [(() x ())] []) () [(SubroutineCall rand_gamma0 [(() a ()) (() (Logical .false.) ()) (() (FuncCallOrArray x [(() i ())] []) ())] [])])] []) (Subroutine rand_gamma_vector [(a) (x)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [(() ())] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall rand_gamma_vector_n [(() a ()) (() (FuncCallOrArray size [(() x ())] []) ()) (() x ())] [])] []) (Subroutine rand_gamma_matrix [(a) (x)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [(() ()) (() ())] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall rand_gamma_vector_n [(() a ()) (() (FuncCallOrArray size [(() x ())] []) ()) (() x ())] [])] [])])]) +(TranslationUnit [(Module random [(Use types [(UseSymbol dp ())]) (Use utils [(UseSymbol stop_error ())])] [(Declaration [(() () () [] [] [(Attribute private [] [])] ())]) (Declaration [(randn () () [] [] [(Attribute public [] [])] ()) (rand_gamma () () [] [] [(Attribute public [] [])] ())]) (Interface (InterfaceHeader2 randn) [(InterfaceModuleProcedure [randn_scalar]) (InterfaceModuleProcedure [randn_vector]) (InterfaceModuleProcedure [randn_matrix]) (InterfaceModuleProcedure [randn_vector_n])]) (Interface (InterfaceHeader2 rand_gamma) [(InterfaceModuleProcedure [rand_gamma_scalar]) (InterfaceModuleProcedure [rand_gamma_vector]) (InterfaceModuleProcedure [rand_gamma_matrix]) (InterfaceModuleProcedure [rand_gamma_vector_n])])] [(Subroutine randn_scalar [(x)] [] [(Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(out)] [])] ())]) (Declaration [(first "logical" () [] [] [(Attribute save [] [])] (Logical .true.))]) (Declaration [(u "real" () [(() dp Value)] [(1 2)] [(Attribute save [] [])] ())]) (Declaration [(r2 "real" () [(() dp Value)] [] [] ())])] [(If first [(DoLoop () () () () [(SubroutineCall random_number [(() u ())] []) (= u (- (* 2 u) 1)) (= r2 (FuncCallOrArray sum [(() (** u 2) ())] [])) (If (BoolOp (< r2 1) And (> r2 0)) [(Exit)] [])]) (= u (* u (FuncCallOrArray sqrt [(() (/ (* (u- 2) (FuncCallOrArray log [(() r2 ())] [])) r2) ())] []))) (= x (FuncCallOrArray u [(() 1 ())] []))] [(= x (FuncCallOrArray u [(() 2 ())] []))]) (= first (not first))] []) (Subroutine randn_vector_n [(n) (x)] [] [(Declaration [(n "integer" () [] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [(1 n)] [(Attribute intent [(out)] [])] ())]) (Declaration [(i "integer" () [] [] [] ())])] [(DoLoop i 1 (FuncCallOrArray size [(() x ())] []) () [(SubroutineCall randn [(() (FuncCallOrArray x [(() i ())] []) ())] [])])] []) (Subroutine randn_vector [(x)] [] [(Declaration [(x "real" () [(() dp Value)] [(() ())] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall randn_vector_n [(() (FuncCallOrArray size [(() x ())] []) ()) (() x ())] [])] []) (Subroutine randn_matrix [(x)] [] [(Declaration [(x "real" () [(() dp Value)] [(() ()) (() ())] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall randn_vector_n [(() (FuncCallOrArray size [(() x ())] []) ()) (() x ())] [])] []) (Subroutine rand_gamma0 [(a) (first) (fn_val)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(first "logical" () [] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(fn_val "real" () [(() dp Value)] [] [(Attribute intent [(out)] [])] ())]) (Declaration [(c "real" () [(() dp Value)] [] [(Attribute save [] [])] ()) (d "real" () [(() dp Value)] [] [(Attribute save [] [])] ())]) (Declaration [(U "real" () [(() dp Value)] [] [] ()) (v "real" () [(() dp Value)] [] [] ()) (x "real" () [(() dp Value)] [] [] ())])] [(If (< a 1) [(SubroutineCall stop_error [(() (Str "Shape parameter must be >= 1") ())] [])] []) (If first [(= d (- a (/ (Real "1._dp") 3))) (= c (/ 1 (FuncCallOrArray sqrt [(() (* 9 d) ())] [])))] []) (DoLoop () () () () [(DoLoop () () () () [(SubroutineCall randn [(() x ())] []) (= v (** (+ 1 (* c x)) 3)) (If (> v 0) [(Exit)] [])]) (SubroutineCall random_number [(() U ())] []) (If (< U (- 1 (* (Real "0.0331_dp") (** x 4)))) [(= fn_val (* d v)) (Exit)] [(If (< (FuncCallOrArray log [(() U ())] []) (+ (/ (** x 2) 2) (* d (+ (- 1 v) (FuncCallOrArray log [(() v ())] []))))) [(= fn_val (* d v)) (Exit)] [])])])] []) (Subroutine rand_gamma_scalar [(a) (x)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall rand_gamma0 [(() a ()) (() (Logical .true.) ()) (() x ())] [])] []) (Subroutine rand_gamma_vector_n [(a) (n) (x)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(n "integer" () [] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [(1 n)] [(Attribute intent [(out)] [])] ())]) (Declaration [(i "integer" () [] [] [] ())])] [(SubroutineCall rand_gamma0 [(() a ()) (() (Logical .true.) ()) (() (FuncCallOrArray x [(() 1 ())] []) ())] []) (DoLoop i 2 (FuncCallOrArray size [(() x ())] []) () [(SubroutineCall rand_gamma0 [(() a ()) (() (Logical .false.) ()) (() (FuncCallOrArray x [(() i ())] []) ())] [])])] []) (Subroutine rand_gamma_vector [(a) (x)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [(() ())] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall rand_gamma_vector_n [(() a ()) (() (FuncCallOrArray size [(() x ())] []) ()) (() x ())] [])] []) (Subroutine rand_gamma_matrix [(a) (x)] [] [(Declaration [(a "real" () [(() dp Value)] [] [(Attribute intent [(in)] [])] ())]) (Declaration [(x "real" () [(() dp Value)] [(() ()) (() ())] [(Attribute intent [(out)] [])] ())])] [(SubroutineCall rand_gamma_vector_n [(() a ()) (() (FuncCallOrArray size [(() x ())] []) ()) (() x ())] [])] [])])]) diff --git a/tests/reference/ast-modules_02-ed49715.json b/tests/reference/ast-modules_02-ed49715.json index b0dda58755..c98af6eb0b 100644 --- a/tests/reference/ast-modules_02-ed49715.json +++ b/tests/reference/ast-modules_02-ed49715.json @@ -2,11 +2,11 @@ "basename": "ast-modules_02-ed49715", "cmd": "lfortran --show-ast --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/modules_02.f90", - "infile_hash": "0017a1f6dd0f8cec33539f6ae2dade51b7c4e4756968d9c423a9ac66", + "infile_hash": "887bcd0c13724335791cfd2de3e820c61e06230aa7bfc9ff56b446c1", "outfile": null, "outfile_hash": null, "stdout": "ast-modules_02-ed49715.stdout", - "stdout_hash": "438e57fc80f53c5d9213d98338caa6b2caa8105042eb7584f297c21c", + "stdout_hash": "1ca295ff363727658e7c77bddf5320cc2ded443af071b22a0cdbb173", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-modules_02-ed49715.stdout b/tests/reference/ast-modules_02-ed49715.stdout index 37f3fbbe01..b07ba2ba37 100644 --- a/tests/reference/ast-modules_02-ed49715.stdout +++ b/tests/reference/ast-modules_02-ed49715.stdout @@ -1 +1 @@ -(TranslationUnit [(Module a [] [] [(Subroutine b [] [] [] [(Print () [(Str "b()")])] [])]) (Module c [] [] [(Subroutine d [] [] [] [(Print () [(Str "d()")])] [])]) (Program modules_02 [(Use a []) (Use c [(UseSymbol d x)])] [] [(SubroutineCall b [] []) (SubroutineCall x [] [])] [])]) +(TranslationUnit [(Module a_02 [] [] [(Subroutine b [] [] [] [(Print () [(Str "b()")])] [])]) (Module c_02 [] [] [(Subroutine d [] [] [] [(Print () [(Str "d()")])] []) (Subroutine e [] [] [] [(Print () [(Str "e()")])] [])]) (Program modules_02 [(Use a_02 []) (Use c_02 [(UseSymbol d x)]) (Use c_02 [(UseSymbol e ())])] [] [(SubroutineCall b [] []) (SubroutineCall x [] []) (SubroutineCall e [] [])] [])]) diff --git a/tests/reference/ast-modules_03-6fa1dfa.json b/tests/reference/ast-modules_03-6fa1dfa.json index 5f7fd76965..e31b7fae92 100644 --- a/tests/reference/ast-modules_03-6fa1dfa.json +++ b/tests/reference/ast-modules_03-6fa1dfa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "ast-modules_03-6fa1dfa.stdout", - "stdout_hash": "01571d0c9c5fce3aa959532afb02a51290059e35de15316c165f36ac", + "stdout_hash": "10737efd989e3ac9a0f7421c2fe7e1d3fc7e87a1c3d50e537bf64ece", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-modules_03-6fa1dfa.stdout b/tests/reference/ast-modules_03-6fa1dfa.stdout index 9ffe336974..bddd0feac6 100644 --- a/tests/reference/ast-modules_03-6fa1dfa.stdout +++ b/tests/reference/ast-modules_03-6fa1dfa.stdout @@ -1 +1 @@ -(TranslationUnit [(Module types [] [(Declaration [(() () () [] [] [(Attribute private [] [])] ())]) (Declaration [(dp () () [] [] [(Attribute public [] [])] ())]) (Declaration [(dp "integer" () [] [] [(Attribute parameter [] [])] (FuncCallOrArray kind [(() (Real "0.d0") ())] []))])] []) (Module constants [] [(Declaration [(() () () [] [] [(Attribute private [] [])] ())]) (Declaration [(pi () () [] [] [(Attribute public [] [])] ()) (e_ () () [] [] [(Attribute public [] [])] ()) (i_ () () [] [] [(Attribute public [] [])] ()) (bohr2ang () () [] [] [(Attribute public [] [])] ()) (ang2bohr () () [] [] [(Attribute public [] [])] ()) (Ha2eV () () [] [] [(Attribute public [] [])] ()) (kB () () [] [] [(Attribute public [] [])] ()) (K2au () () [] [] [(Attribute public [] [])] ()) (density2gcm3 () () [] [] [(Attribute public [] [])] ()) (u2au () () [] [] [(Attribute public [] [])] ()) (s2au () () [] [] [(Attribute public [] [])] ()) (kJmol2Ha () () [] [] [(Attribute public [] [])] ())]) (Declaration [(pi "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "3.1415926535897932384626433832795_dp"))]) (Declaration [(e_ "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "2.7182818284590452353602874713527_dp"))]) (Declaration [(i_ "complex" () [(() dp Value)] [] [(Attribute parameter [] [])] (Complex 0 1))]) (Declaration [(Na "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "6.02214129e23_dp"))]) (Declaration [(Ha2eV "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "27.21138505_dp"))]) (Declaration [(J2Ha "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "2.29371248e17_dp"))]) (Declaration [(hbar "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "1.054571726e-34_dp"))]) (Declaration [(Ha2invcm "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "219474.6313708_dp"))]) (Declaration [(kB "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "1.3806488e-23_dp"))]) (Declaration [(me "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "9.10938291e-31_dp"))]) (Declaration [(K2au "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (* J2Ha kB))]) (Declaration [(bohr2ang "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "0.529177249_dp"))]) (Declaration [(ang2bohr "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ 1 bohr2ang))]) (Declaration [(kcalmol2kJmol "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "4.184_dp"))]) (Declaration [(kJmol2Ha "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ (* 1000 J2Ha) Na))]) (Declaration [(density2gcm3 "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ (* me (Real "1e3_dp")) (** (* bohr2ang (Real "1e-8_dp")) 3)))]) (Declaration [(u2au "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ 1 (* (* Na me) (Real "1e3_dp"))))]) (Declaration [(s2au "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ 1 (* J2Ha hbar)))])] []) (Program modules_03 [(Use constants [(UseSymbol Ha2eV ())])] [] [(Print () [Ha2eV])] [])]) +(TranslationUnit [(Module types [] [(Declaration [(() () () [] [] [(Attribute private [] [])] ())]) (Declaration [(dp () () [] [] [(Attribute public [] [])] ())]) (Declaration [(dp "integer" () [] [] [(Attribute parameter [] [])] (FuncCallOrArray kind [(() (Real "0.d0") ())] []))])] []) (Module constants [(Use types [(UseSymbol dp ())])] [(Declaration [(() () () [] [] [(Attribute private [] [])] ())]) (Declaration [(pi () () [] [] [(Attribute public [] [])] ()) (e_ () () [] [] [(Attribute public [] [])] ()) (i_ () () [] [] [(Attribute public [] [])] ()) (bohr2ang () () [] [] [(Attribute public [] [])] ()) (ang2bohr () () [] [] [(Attribute public [] [])] ()) (Ha2eV () () [] [] [(Attribute public [] [])] ()) (kB () () [] [] [(Attribute public [] [])] ()) (K2au () () [] [] [(Attribute public [] [])] ()) (density2gcm3 () () [] [] [(Attribute public [] [])] ()) (u2au () () [] [] [(Attribute public [] [])] ()) (s2au () () [] [] [(Attribute public [] [])] ()) (kJmol2Ha () () [] [] [(Attribute public [] [])] ())]) (Declaration [(pi "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "3.1415926535897932384626433832795_dp"))]) (Declaration [(e_ "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "2.7182818284590452353602874713527_dp"))]) (Declaration [(i_ "complex" () [(() dp Value)] [] [(Attribute parameter [] [])] (Complex 0 1))]) (Declaration [(Na "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "6.02214129e23_dp"))]) (Declaration [(Ha2eV "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "27.21138505_dp"))]) (Declaration [(J2Ha "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "2.29371248e17_dp"))]) (Declaration [(hbar "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "1.054571726e-34_dp"))]) (Declaration [(Ha2invcm "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "219474.6313708_dp"))]) (Declaration [(kB "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "1.3806488e-23_dp"))]) (Declaration [(me "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "9.10938291e-31_dp"))]) (Declaration [(K2au "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (* J2Ha kB))]) (Declaration [(bohr2ang "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "0.529177249_dp"))]) (Declaration [(ang2bohr "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ 1 bohr2ang))]) (Declaration [(kcalmol2kJmol "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (Real "4.184_dp"))]) (Declaration [(kJmol2Ha "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ (* 1000 J2Ha) Na))]) (Declaration [(density2gcm3 "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ (* me (Real "1e3_dp")) (** (* bohr2ang (Real "1e-8_dp")) 3)))]) (Declaration [(u2au "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ 1 (* (* Na me) (Real "1e3_dp"))))]) (Declaration [(s2au "real" () [(() dp Value)] [] [(Attribute parameter [] [])] (/ 1 (* J2Ha hbar)))])] []) (Program modules_03 [(Use constants [(UseSymbol Ha2eV ())])] [] [(Print () [Ha2eV])] [])]) diff --git a/tests/reference/ast-modules_04-a8954ed.json b/tests/reference/ast-modules_04-a8954ed.json index cbe51ea740..e9281a56c3 100644 --- a/tests/reference/ast-modules_04-a8954ed.json +++ b/tests/reference/ast-modules_04-a8954ed.json @@ -2,11 +2,11 @@ "basename": "ast-modules_04-a8954ed", "cmd": "lfortran --show-ast --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/modules_04.f90", - "infile_hash": "1799f2583c62a5c741cd3e4600fbc89078fcc3e490625f810704a9d8", + "infile_hash": "c2a3f2488f0cbfc5efc150ea277129289bfb30dc2a42d33d4861357b", "outfile": null, "outfile_hash": null, "stdout": "ast-modules_04-a8954ed.stdout", - "stdout_hash": "1b6600870c85b95df2114506eb8cbc26a520a0213966b0714acc0ecc", + "stdout_hash": "cb2582fa71d01aaf3eab3a70c430b4a15f3837cebd8216658175ca27", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/ast-modules_04-a8954ed.stdout b/tests/reference/ast-modules_04-a8954ed.stdout index 94438c0622..ab9364d3ec 100644 --- a/tests/reference/ast-modules_04-a8954ed.stdout +++ b/tests/reference/ast-modules_04-a8954ed.stdout @@ -1 +1 @@ -(TranslationUnit [(Module a [] [] [(Subroutine b [] [] [] [(Print () [(Str "b()")])] [])]) (Program modules_04 [(Use iso_fortran_env [])] [] [(SubroutineCall f [] [])] [(Subroutine f [] [] [] [(SubroutineCall b [] [])] []) (Function g [] "integer" () () [] [] [(SubroutineCall b [] []) (= g 5)] [])])]) +(TranslationUnit [(Module a_04 [] [] [(Subroutine b [] [] [] [(Print () [(Str "b()")])] [])]) (Program modules_04 [(Use iso_fortran_env [])] [] [(SubroutineCall f [] [])] [(Subroutine f [] [] [] [(SubroutineCall b [] [])] []) (Function g [] "integer" () () [] [] [(SubroutineCall b [] []) (= g 5)] [])])]) diff --git a/tests/reference/ast-modules_06-7f94d73.json b/tests/reference/ast-modules_06-7f94d73.json new file mode 100644 index 0000000000..beb73607e9 --- /dev/null +++ b/tests/reference/ast-modules_06-7f94d73.json @@ -0,0 +1,13 @@ +{ + "basename": "ast-modules_06-7f94d73", + "cmd": "lfortran --show-ast --no-color {infile} -o {outfile}", + "infile": "tests/modules_06.f90", + "infile_hash": "7699c2084686f687c1681ea9d088f613f3530b48449a37df5fc1cdce", + "outfile": null, + "outfile_hash": null, + "stdout": "ast-modules_06-7f94d73.stdout", + "stdout_hash": "7bfad041fbeb6915ed6189587c28cb09761e9d4d2291fa8aef55e26c", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/ast-modules_06-7f94d73.stdout b/tests/reference/ast-modules_06-7f94d73.stdout new file mode 100644 index 0000000000..fc19ee4dba --- /dev/null +++ b/tests/reference/ast-modules_06-7f94d73.stdout @@ -0,0 +1 @@ +(TranslationUnit [(Module modules_06_b [] [(Declaration [(() () () [] [] [(Attribute private [] [])] ())]) (Declaration [(b () () [] [] [(Attribute public [] [])] ())])] [(Function b [] "integer" () () [] [] [(= b 5)] [])]) (Module modules_06_a [(Use modules_06_b [(UseSymbol b ())])] [(Declaration [(() () () [] [] [(Attribute private [] [])] ())]) (Declaration [(a () () [] [] [(Attribute public [] [])] ())])] [(Function a [] "integer" () () [] [] [(= a (+ 3 (FuncCallOrArray b [] [])))] [])])]) diff --git a/tests/reference/ast_f90-allocate_01-46f450b.json b/tests/reference/ast_f90-allocate_01-46f450b.json new file mode 100644 index 0000000000..917a6559a8 --- /dev/null +++ b/tests/reference/ast_f90-allocate_01-46f450b.json @@ -0,0 +1,13 @@ +{ + "basename": "ast_f90-allocate_01-46f450b", + "cmd": "lfortran --show-ast-f90 --no-color {infile}", + "infile": "tests/../integration_tests/allocate_01.f90", + "infile_hash": "c00859de3927508b3835d0243cf2348621ba293389e3b69ff53725ef", + "outfile": null, + "outfile_hash": null, + "stdout": "ast_f90-allocate_01-46f450b.stdout", + "stdout_hash": "54c0402f06e855bef4b5df38ee19f6ab9533a1c56159d60b1f4e5391", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/ast_f90-allocate_01-46f450b.stdout b/tests/reference/ast_f90-allocate_01-46f450b.stdout new file mode 100644 index 0000000000..8f387ee5b1 --- /dev/null +++ b/tests/reference/ast_f90-allocate_01-46f450b.stdout @@ -0,0 +1,11 @@ +program allocate_01 +real, allocatable :: a(:) +real, allocatable :: b(:,:) +real, allocatable :: c(:,:,:) +integer :: n +integer :: ierr +n = 10 +allocate(a(5)) +allocate(b(n, n), c(n, 5, n), stat=ierr) +deallocate(a, c) +end program allocate_01 diff --git a/tests/reference/ast_f90-doconcurrentloop_01-8d5be08.json b/tests/reference/ast_f90-doconcurrentloop_01-8d5be08.json new file mode 100644 index 0000000000..17260882da --- /dev/null +++ b/tests/reference/ast_f90-doconcurrentloop_01-8d5be08.json @@ -0,0 +1,13 @@ +{ + "basename": "ast_f90-doconcurrentloop_01-8d5be08", + "cmd": "lfortran --show-ast-f90 --no-color {infile}", + "infile": "tests/../integration_tests/doconcurrentloop_01.f90", + "infile_hash": "467f7dbdb5186badc19797a42685003effc780bd17088ab9fcc27efb", + "outfile": null, + "outfile_hash": null, + "stdout": "ast_f90-doconcurrentloop_01-8d5be08.stdout", + "stdout_hash": "c8a5e9de1513b9c08ed3cd86815e023ab87601e0fe10b8522b49733c", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/ast_f90-doconcurrentloop_01-8d5be08.stdout b/tests/reference/ast_f90-doconcurrentloop_01-8d5be08.stdout new file mode 100644 index 0000000000..842555df82 --- /dev/null +++ b/tests/reference/ast_f90-doconcurrentloop_01-8d5be08.stdout @@ -0,0 +1,32 @@ +program doconcurrentloop_01 +real, dimension(10000) :: a +real, dimension(10000) :: b +real, dimension(10000) :: c +real :: scalar +integer :: i +integer :: nsize +scalar = 10 +nsize = size(a) +do concurrent (i = 1:nsize) + a(i) = 5 + b(i) = 5 +end do +call triad(a, b, scalar, c) +print *, "End Stream Triad" + +contains + + subroutine triad(a, b, scalar, c) + real, intent(in) :: a(:) + real, intent(in) :: b(:) + real, intent(in) :: scalar + real, intent(out) :: c(:) + integer :: N + integer :: i + N = size(a) + do concurrent (i = 1:N) + c(i) = (a(i)) + ((scalar)*(b(i))) + end do + end subroutine triad + +end program doconcurrentloop_01 diff --git a/tests/reference/llvm-bin_op_complex_dp-e3d6511.json b/tests/reference/llvm-bin_op_complex_dp-e3d6511.json new file mode 100644 index 0000000000..611380403d --- /dev/null +++ b/tests/reference/llvm-bin_op_complex_dp-e3d6511.json @@ -0,0 +1,13 @@ +{ + "basename": "llvm-bin_op_complex_dp-e3d6511", + "cmd": "lfortran --show-llvm {infile} -o {outfile}", + "infile": "tests/../integration_tests/bin_op_complex_dp.f90", + "infile_hash": "9be1b396941b73e1466a46963ee3ade085440ce077b444ce7e2f6baf", + "outfile": null, + "outfile_hash": null, + "stdout": "llvm-bin_op_complex_dp-e3d6511.stdout", + "stdout_hash": "48abf113a3fad0b9c4aad3df55a418ae2b5f72fea1c5d52af025fba1", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/llvm-bin_op_complex_dp-e3d6511.stdout b/tests/reference/llvm-bin_op_complex_dp-e3d6511.stdout new file mode 100644 index 0000000000..4579abd3dd --- /dev/null +++ b/tests/reference/llvm-bin_op_complex_dp-e3d6511.stdout @@ -0,0 +1,88 @@ +; ModuleID = 'LFortran' +source_filename = "LFortran" + +%complex_8 = type { double, double } +%complex_4 = type { float, float } + +@0 = private unnamed_addr constant [37 x i8] c"(%f,%f) (%lf,%lf) (%f,%f) (%lf,%lf)\0A\00", align 1 + +define i32 @main() { +.entry: + %u = alloca %complex_8, align 8 + %v = alloca %complex_8, align 8 + %x = alloca %complex_4, align 8 + %zero = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 + store float 0x3FC24924A0000000, float* %1, align 4 + store float 0.000000e+00, float* %2, align 4 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %zero, align 4 + %4 = alloca %complex_8, align 8 + %5 = getelementptr %complex_8, %complex_8* %4, i32 0, i32 0 + %6 = getelementptr %complex_8, %complex_8* %4, i32 0, i32 1 + store double 0x3FC24924A0000000, double* %5, align 8 + store double 0.000000e+00, double* %6, align 8 + %7 = load %complex_8, %complex_8* %4, align 8 + store %complex_8 %7, %complex_8* %u, align 8 + %8 = alloca %complex_8, align 8 + %9 = getelementptr %complex_8, %complex_8* %8, i32 0, i32 0 + %10 = getelementptr %complex_8, %complex_8* %8, i32 0, i32 1 + store double 0x3FC2492492492492, double* %9, align 8 + store double 0.000000e+00, double* %10, align 8 + %11 = load %complex_8, %complex_8* %8, align 8 + store %complex_8 %11, %complex_8* %v, align 8 + %12 = alloca %complex_4, align 8 + %13 = getelementptr %complex_4, %complex_4* %12, i32 0, i32 0 + %14 = getelementptr %complex_4, %complex_4* %12, i32 0, i32 1 + store float 0x3FC24924A0000000, float* %13, align 4 + store float 0.000000e+00, float* %14, align 4 + %15 = load %complex_4, %complex_4* %12, align 4 + store %complex_4 %15, %complex_4* %x, align 4 + %16 = load %complex_4, %complex_4* %zero, align 4 + %17 = alloca %complex_4, align 8 + store %complex_4 %16, %complex_4* %17, align 4 + %18 = getelementptr %complex_4, %complex_4* %17, i32 0, i32 0 + %19 = load float, float* %18, align 4 + %20 = fpext float %19 to double + %21 = alloca %complex_4, align 8 + store %complex_4 %16, %complex_4* %21, align 4 + %22 = getelementptr %complex_4, %complex_4* %21, i32 0, i32 1 + %23 = load float, float* %22, align 4 + %24 = fpext float %23 to double + %25 = load %complex_8, %complex_8* %v, align 8 + %26 = alloca %complex_8, align 8 + store %complex_8 %25, %complex_8* %26, align 8 + %27 = getelementptr %complex_8, %complex_8* %26, i32 0, i32 0 + %28 = load double, double* %27, align 8 + %29 = alloca %complex_8, align 8 + store %complex_8 %25, %complex_8* %29, align 8 + %30 = getelementptr %complex_8, %complex_8* %29, i32 0, i32 1 + %31 = load double, double* %30, align 8 + %32 = load %complex_4, %complex_4* %x, align 4 + %33 = alloca %complex_4, align 8 + store %complex_4 %32, %complex_4* %33, align 4 + %34 = getelementptr %complex_4, %complex_4* %33, i32 0, i32 0 + %35 = load float, float* %34, align 4 + %36 = fpext float %35 to double + %37 = alloca %complex_4, align 8 + store %complex_4 %32, %complex_4* %37, align 4 + %38 = getelementptr %complex_4, %complex_4* %37, i32 0, i32 1 + %39 = load float, float* %38, align 4 + %40 = fpext float %39 to double + %41 = load %complex_8, %complex_8* %u, align 8 + %42 = alloca %complex_8, align 8 + store %complex_8 %41, %complex_8* %42, align 8 + %43 = getelementptr %complex_8, %complex_8* %42, i32 0, i32 0 + %44 = load double, double* %43, align 8 + %45 = alloca %complex_8, align 8 + store %complex_8 %41, %complex_8* %45, align 8 + %46 = getelementptr %complex_8, %complex_8* %45, i32 0, i32 1 + %47 = load double, double* %46, align 8 + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @0, i32 0, i32 0), double %20, double %24, double %28, double %31, double %36, double %40, double %44, double %47) + ret i32 0 +} + +declare void @_lfortran_printf(i8*, ...) + diff --git a/tests/reference/llvm-complex1-30fe592.json b/tests/reference/llvm-complex1-30fe592.json index daeb17355c..c29e961e5d 100644 --- a/tests/reference/llvm-complex1-30fe592.json +++ b/tests/reference/llvm-complex1-30fe592.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-complex1-30fe592.stdout", - "stdout_hash": "59f18dbd48f6c6d3541677ef3e13cf97359ce52e6ee0bad9e312ec19", + "stdout_hash": "3e1c12df6c4621b87de256742e560d9debfa0b1c9b4342cf5ec82a34", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-complex1-30fe592.stdout b/tests/reference/llvm-complex1-30fe592.stdout index a49bac47c2..a2db6c6af2 100644 --- a/tests/reference/llvm-complex1-30fe592.stdout +++ b/tests/reference/llvm-complex1-30fe592.stdout @@ -1,18 +1,18 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -%complex = type { float, float } +%complex_4 = type { float, float } define i32 @main() { .entry: - %x = alloca %complex, align 8 - %0 = alloca %complex, align 8 - %1 = getelementptr %complex, %complex* %0, i32 0, i32 0 - %2 = getelementptr %complex, %complex* %0, i32 0, i32 1 + %x = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 store float 3.000000e+00, float* %1, align 4 store float 4.000000e+00, float* %2, align 4 - %3 = load %complex, %complex* %0, align 4 - store %complex %3, %complex* %x, align 4 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %x, align 4 ret i32 0 } diff --git a/tests/reference/llvm-complex2-977bfad.json b/tests/reference/llvm-complex2-977bfad.json index 9afe1e6a68..8a0fed103b 100644 --- a/tests/reference/llvm-complex2-977bfad.json +++ b/tests/reference/llvm-complex2-977bfad.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-complex2-977bfad.stdout", - "stdout_hash": "03da52bb91ded681d60a26106e82abb56ec7ecc7be3508fc5a4ce195", + "stdout_hash": "2d3813f4814b3ca2b9e1b2afc239f576e59c3c02fb840fefda4eb473", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-complex2-977bfad.stdout b/tests/reference/llvm-complex2-977bfad.stdout index 4ad1c2e85b..0d40cc9887 100644 --- a/tests/reference/llvm-complex2-977bfad.stdout +++ b/tests/reference/llvm-complex2-977bfad.stdout @@ -1,7 +1,7 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -%complex = type { float, float } +%complex_4 = type { float, float } @0 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 @1 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 @@ -9,112 +9,112 @@ source_filename = "LFortran" define i32 @main() { .entry: - %x = alloca %complex, align 8 - %0 = alloca %complex, align 8 - %1 = getelementptr %complex, %complex* %0, i32 0, i32 0 - %2 = getelementptr %complex, %complex* %0, i32 0, i32 1 + %x = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 store float 3.000000e+00, float* %1, align 4 store float 4.000000e+00, float* %2, align 4 - %3 = load %complex, %complex* %0, align 4 - store %complex %3, %complex* %x, align 4 - %4 = load %complex, %complex* %x, align 4 - %5 = alloca %complex, align 8 - %6 = getelementptr %complex, %complex* %5, i32 0, i32 0 - %7 = getelementptr %complex, %complex* %5, i32 0, i32 1 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %x, align 4 + %4 = load %complex_4, %complex_4* %x, align 4 + %5 = alloca %complex_4, align 8 + %6 = getelementptr %complex_4, %complex_4* %5, i32 0, i32 0 + %7 = getelementptr %complex_4, %complex_4* %5, i32 0, i32 1 store float 4.000000e+00, float* %6, align 4 store float 0.000000e+00, float* %7, align 4 - %8 = load %complex, %complex* %5, align 4 - %9 = alloca %complex, align 8 - store %complex %4, %complex* %9, align 4 - %10 = alloca %complex, align 8 - store %complex %8, %complex* %10, align 4 - %11 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_add(%complex* %9, %complex* %10, %complex* %11) - %12 = load %complex, %complex* %11, align 4 - store %complex %12, %complex* %x, align 4 - %13 = load %complex, %complex* %x, align 4 - %14 = alloca %complex, align 8 - store %complex %13, %complex* %14, align 4 - %15 = getelementptr %complex, %complex* %14, i32 0, i32 0 + %8 = load %complex_4, %complex_4* %5, align 4 + %9 = alloca %complex_4, align 8 + store %complex_4 %4, %complex_4* %9, align 4 + %10 = alloca %complex_4, align 8 + store %complex_4 %8, %complex_4* %10, align 4 + %11 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_add(%complex_4* %9, %complex_4* %10, %complex_4* %11) + %12 = load %complex_4, %complex_4* %11, align 4 + store %complex_4 %12, %complex_4* %x, align 4 + %13 = load %complex_4, %complex_4* %x, align 4 + %14 = alloca %complex_4, align 8 + store %complex_4 %13, %complex_4* %14, align 4 + %15 = getelementptr %complex_4, %complex_4* %14, i32 0, i32 0 %16 = load float, float* %15, align 4 %17 = fpext float %16 to double - %18 = alloca %complex, align 8 - store %complex %13, %complex* %18, align 4 - %19 = getelementptr %complex, %complex* %18, i32 0, i32 1 + %18 = alloca %complex_4, align 8 + store %complex_4 %13, %complex_4* %18, align 4 + %19 = getelementptr %complex_4, %complex_4* %18, i32 0, i32 1 %20 = load float, float* %19, align 4 %21 = fpext float %20 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @0, i32 0, i32 0), double %17, double %21) - %22 = alloca %complex, align 8 - %23 = getelementptr %complex, %complex* %22, i32 0, i32 0 - %24 = getelementptr %complex, %complex* %22, i32 0, i32 1 + %22 = alloca %complex_4, align 8 + %23 = getelementptr %complex_4, %complex_4* %22, i32 0, i32 0 + %24 = getelementptr %complex_4, %complex_4* %22, i32 0, i32 1 store float 2.000000e+00, float* %23, align 4 store float 0.000000e+00, float* %24, align 4 - %25 = load %complex, %complex* %22, align 4 - %26 = load %complex, %complex* %x, align 4 - %27 = alloca %complex, align 8 - store %complex %25, %complex* %27, align 4 - %28 = alloca %complex, align 8 - store %complex %26, %complex* %28, align 4 - %29 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_add(%complex* %27, %complex* %28, %complex* %29) - %30 = load %complex, %complex* %29, align 4 - store %complex %30, %complex* %x, align 4 - %31 = load %complex, %complex* %x, align 4 - %32 = alloca %complex, align 8 - store %complex %31, %complex* %32, align 4 - %33 = getelementptr %complex, %complex* %32, i32 0, i32 0 + %25 = load %complex_4, %complex_4* %22, align 4 + %26 = load %complex_4, %complex_4* %x, align 4 + %27 = alloca %complex_4, align 8 + store %complex_4 %25, %complex_4* %27, align 4 + %28 = alloca %complex_4, align 8 + store %complex_4 %26, %complex_4* %28, align 4 + %29 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_add(%complex_4* %27, %complex_4* %28, %complex_4* %29) + %30 = load %complex_4, %complex_4* %29, align 4 + store %complex_4 %30, %complex_4* %x, align 4 + %31 = load %complex_4, %complex_4* %x, align 4 + %32 = alloca %complex_4, align 8 + store %complex_4 %31, %complex_4* %32, align 4 + %33 = getelementptr %complex_4, %complex_4* %32, i32 0, i32 0 %34 = load float, float* %33, align 4 %35 = fpext float %34 to double - %36 = alloca %complex, align 8 - store %complex %31, %complex* %36, align 4 - %37 = getelementptr %complex, %complex* %36, i32 0, i32 1 + %36 = alloca %complex_4, align 8 + store %complex_4 %31, %complex_4* %36, align 4 + %37 = getelementptr %complex_4, %complex_4* %36, i32 0, i32 1 %38 = load float, float* %37, align 4 %39 = fpext float %38 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @1, i32 0, i32 0), double %35, double %39) - %40 = alloca %complex, align 8 - %41 = getelementptr %complex, %complex* %40, i32 0, i32 0 - %42 = getelementptr %complex, %complex* %40, i32 0, i32 1 + %40 = alloca %complex_4, align 8 + %41 = getelementptr %complex_4, %complex_4* %40, i32 0, i32 0 + %42 = getelementptr %complex_4, %complex_4* %40, i32 0, i32 1 store float 2.000000e+00, float* %41, align 4 store float 0.000000e+00, float* %42, align 4 - %43 = load %complex, %complex* %40, align 4 - %44 = load %complex, %complex* %x, align 4 - %45 = alloca %complex, align 8 - store %complex %43, %complex* %45, align 4 - %46 = alloca %complex, align 8 - store %complex %44, %complex* %46, align 4 - %47 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_add(%complex* %45, %complex* %46, %complex* %47) - %48 = load %complex, %complex* %47, align 4 - %49 = alloca %complex, align 8 - %50 = getelementptr %complex, %complex* %49, i32 0, i32 0 - %51 = getelementptr %complex, %complex* %49, i32 0, i32 1 + %43 = load %complex_4, %complex_4* %40, align 4 + %44 = load %complex_4, %complex_4* %x, align 4 + %45 = alloca %complex_4, align 8 + store %complex_4 %43, %complex_4* %45, align 4 + %46 = alloca %complex_4, align 8 + store %complex_4 %44, %complex_4* %46, align 4 + %47 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_add(%complex_4* %45, %complex_4* %46, %complex_4* %47) + %48 = load %complex_4, %complex_4* %47, align 4 + %49 = alloca %complex_4, align 8 + %50 = getelementptr %complex_4, %complex_4* %49, i32 0, i32 0 + %51 = getelementptr %complex_4, %complex_4* %49, i32 0, i32 1 store float 0.000000e+00, float* %50, align 4 store float 3.000000e+00, float* %51, align 4 - %52 = load %complex, %complex* %49, align 4 - %53 = alloca %complex, align 8 - store %complex %48, %complex* %53, align 4 - %54 = alloca %complex, align 8 - store %complex %52, %complex* %54, align 4 - %55 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_add(%complex* %53, %complex* %54, %complex* %55) - %56 = load %complex, %complex* %55, align 4 - store %complex %56, %complex* %x, align 4 - %57 = load %complex, %complex* %x, align 4 - %58 = alloca %complex, align 8 - store %complex %57, %complex* %58, align 4 - %59 = getelementptr %complex, %complex* %58, i32 0, i32 0 + %52 = load %complex_4, %complex_4* %49, align 4 + %53 = alloca %complex_4, align 8 + store %complex_4 %48, %complex_4* %53, align 4 + %54 = alloca %complex_4, align 8 + store %complex_4 %52, %complex_4* %54, align 4 + %55 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_add(%complex_4* %53, %complex_4* %54, %complex_4* %55) + %56 = load %complex_4, %complex_4* %55, align 4 + store %complex_4 %56, %complex_4* %x, align 4 + %57 = load %complex_4, %complex_4* %x, align 4 + %58 = alloca %complex_4, align 8 + store %complex_4 %57, %complex_4* %58, align 4 + %59 = getelementptr %complex_4, %complex_4* %58, i32 0, i32 0 %60 = load float, float* %59, align 4 %61 = fpext float %60 to double - %62 = alloca %complex, align 8 - store %complex %57, %complex* %62, align 4 - %63 = getelementptr %complex, %complex* %62, i32 0, i32 1 + %62 = alloca %complex_4, align 8 + store %complex_4 %57, %complex_4* %62, align 4 + %63 = getelementptr %complex_4, %complex_4* %62, i32 0, i32 1 %64 = load float, float* %63, align 4 %65 = fpext float %64 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @2, i32 0, i32 0), double %61, double %65) ret i32 0 } -declare void @_lfortran_complex_add(%complex*, %complex*, %complex*, ...) +declare void @_lfortran_complex_add(%complex_4*, %complex_4*, %complex_4*, ...) declare void @_lfortran_printf(i8*, ...) diff --git a/tests/reference/llvm-complex_div_test-277d2fa.json b/tests/reference/llvm-complex_div_test-277d2fa.json index c625bf9ea4..08fd2e10e1 100644 --- a/tests/reference/llvm-complex_div_test-277d2fa.json +++ b/tests/reference/llvm-complex_div_test-277d2fa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-complex_div_test-277d2fa.stdout", - "stdout_hash": "baf66874396127a9f86acd78743b565266dbfb10763e1a45a77715c9", + "stdout_hash": "76a728f7a1e5c93aaf69765fb984d744a271a529ad92e5822656dee2", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-complex_div_test-277d2fa.stdout b/tests/reference/llvm-complex_div_test-277d2fa.stdout index 9923360a6b..ecc53b126e 100644 --- a/tests/reference/llvm-complex_div_test-277d2fa.stdout +++ b/tests/reference/llvm-complex_div_test-277d2fa.stdout @@ -1,7 +1,7 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -%complex = type { float, float } +%complex_4 = type { float, float } @0 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 @1 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 @@ -9,114 +9,114 @@ source_filename = "LFortran" define i32 @main() { .entry: - %x = alloca %complex, align 8 - %0 = alloca %complex, align 8 - %1 = getelementptr %complex, %complex* %0, i32 0, i32 0 - %2 = getelementptr %complex, %complex* %0, i32 0, i32 1 + %x = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 store float 3.000000e+00, float* %1, align 4 store float 4.000000e+00, float* %2, align 4 - %3 = load %complex, %complex* %0, align 4 - store %complex %3, %complex* %x, align 4 - %4 = load %complex, %complex* %x, align 4 - %5 = alloca %complex, align 8 - %6 = getelementptr %complex, %complex* %5, i32 0, i32 0 - %7 = getelementptr %complex, %complex* %5, i32 0, i32 1 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %x, align 4 + %4 = load %complex_4, %complex_4* %x, align 4 + %5 = alloca %complex_4, align 8 + %6 = getelementptr %complex_4, %complex_4* %5, i32 0, i32 0 + %7 = getelementptr %complex_4, %complex_4* %5, i32 0, i32 1 store float 4.000000e+00, float* %6, align 4 store float 0.000000e+00, float* %7, align 4 - %8 = load %complex, %complex* %5, align 4 - %9 = alloca %complex, align 8 - store %complex %4, %complex* %9, align 4 - %10 = alloca %complex, align 8 - store %complex %8, %complex* %10, align 4 - %11 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_div(%complex* %9, %complex* %10, %complex* %11) - %12 = load %complex, %complex* %11, align 4 - store %complex %12, %complex* %x, align 4 - %13 = load %complex, %complex* %x, align 4 - %14 = alloca %complex, align 8 - store %complex %13, %complex* %14, align 4 - %15 = getelementptr %complex, %complex* %14, i32 0, i32 0 + %8 = load %complex_4, %complex_4* %5, align 4 + %9 = alloca %complex_4, align 8 + store %complex_4 %4, %complex_4* %9, align 4 + %10 = alloca %complex_4, align 8 + store %complex_4 %8, %complex_4* %10, align 4 + %11 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_div(%complex_4* %9, %complex_4* %10, %complex_4* %11) + %12 = load %complex_4, %complex_4* %11, align 4 + store %complex_4 %12, %complex_4* %x, align 4 + %13 = load %complex_4, %complex_4* %x, align 4 + %14 = alloca %complex_4, align 8 + store %complex_4 %13, %complex_4* %14, align 4 + %15 = getelementptr %complex_4, %complex_4* %14, i32 0, i32 0 %16 = load float, float* %15, align 4 %17 = fpext float %16 to double - %18 = alloca %complex, align 8 - store %complex %13, %complex* %18, align 4 - %19 = getelementptr %complex, %complex* %18, i32 0, i32 1 + %18 = alloca %complex_4, align 8 + store %complex_4 %13, %complex_4* %18, align 4 + %19 = getelementptr %complex_4, %complex_4* %18, i32 0, i32 1 %20 = load float, float* %19, align 4 %21 = fpext float %20 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @0, i32 0, i32 0), double %17, double %21) - %22 = alloca %complex, align 8 - %23 = getelementptr %complex, %complex* %22, i32 0, i32 0 - %24 = getelementptr %complex, %complex* %22, i32 0, i32 1 + %22 = alloca %complex_4, align 8 + %23 = getelementptr %complex_4, %complex_4* %22, i32 0, i32 0 + %24 = getelementptr %complex_4, %complex_4* %22, i32 0, i32 1 store float 2.000000e+00, float* %23, align 4 store float 0.000000e+00, float* %24, align 4 - %25 = load %complex, %complex* %22, align 4 - %26 = load %complex, %complex* %x, align 4 - %27 = alloca %complex, align 8 - store %complex %25, %complex* %27, align 4 - %28 = alloca %complex, align 8 - store %complex %26, %complex* %28, align 4 - %29 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_div(%complex* %27, %complex* %28, %complex* %29) - %30 = load %complex, %complex* %29, align 4 - store %complex %30, %complex* %x, align 4 - %31 = load %complex, %complex* %x, align 4 - %32 = alloca %complex, align 8 - store %complex %31, %complex* %32, align 4 - %33 = getelementptr %complex, %complex* %32, i32 0, i32 0 + %25 = load %complex_4, %complex_4* %22, align 4 + %26 = load %complex_4, %complex_4* %x, align 4 + %27 = alloca %complex_4, align 8 + store %complex_4 %25, %complex_4* %27, align 4 + %28 = alloca %complex_4, align 8 + store %complex_4 %26, %complex_4* %28, align 4 + %29 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_div(%complex_4* %27, %complex_4* %28, %complex_4* %29) + %30 = load %complex_4, %complex_4* %29, align 4 + store %complex_4 %30, %complex_4* %x, align 4 + %31 = load %complex_4, %complex_4* %x, align 4 + %32 = alloca %complex_4, align 8 + store %complex_4 %31, %complex_4* %32, align 4 + %33 = getelementptr %complex_4, %complex_4* %32, i32 0, i32 0 %34 = load float, float* %33, align 4 %35 = fpext float %34 to double - %36 = alloca %complex, align 8 - store %complex %31, %complex* %36, align 4 - %37 = getelementptr %complex, %complex* %36, i32 0, i32 1 + %36 = alloca %complex_4, align 8 + store %complex_4 %31, %complex_4* %36, align 4 + %37 = getelementptr %complex_4, %complex_4* %36, i32 0, i32 1 %38 = load float, float* %37, align 4 %39 = fpext float %38 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @1, i32 0, i32 0), double %35, double %39) - %40 = alloca %complex, align 8 - %41 = getelementptr %complex, %complex* %40, i32 0, i32 0 - %42 = getelementptr %complex, %complex* %40, i32 0, i32 1 + %40 = alloca %complex_4, align 8 + %41 = getelementptr %complex_4, %complex_4* %40, i32 0, i32 0 + %42 = getelementptr %complex_4, %complex_4* %40, i32 0, i32 1 store float 1.000000e+00, float* %41, align 4 store float 0.000000e+00, float* %42, align 4 - %43 = load %complex, %complex* %40, align 4 - %44 = load %complex, %complex* %x, align 4 - %45 = alloca %complex, align 8 - %46 = getelementptr %complex, %complex* %45, i32 0, i32 0 - %47 = getelementptr %complex, %complex* %45, i32 0, i32 1 + %43 = load %complex_4, %complex_4* %40, align 4 + %44 = load %complex_4, %complex_4* %x, align 4 + %45 = alloca %complex_4, align 8 + %46 = getelementptr %complex_4, %complex_4* %45, i32 0, i32 0 + %47 = getelementptr %complex_4, %complex_4* %45, i32 0, i32 1 store float 0.000000e+00, float* %46, align 4 store float 3.000000e+00, float* %47, align 4 - %48 = load %complex, %complex* %45, align 4 - %49 = alloca %complex, align 8 - store %complex %44, %complex* %49, align 4 - %50 = alloca %complex, align 8 - store %complex %48, %complex* %50, align 4 - %51 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_add(%complex* %49, %complex* %50, %complex* %51) - %52 = load %complex, %complex* %51, align 4 - %53 = alloca %complex, align 8 - store %complex %43, %complex* %53, align 4 - %54 = alloca %complex, align 8 - store %complex %52, %complex* %54, align 4 - %55 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_div(%complex* %53, %complex* %54, %complex* %55) - %56 = load %complex, %complex* %55, align 4 - store %complex %56, %complex* %x, align 4 - %57 = load %complex, %complex* %x, align 4 - %58 = alloca %complex, align 8 - store %complex %57, %complex* %58, align 4 - %59 = getelementptr %complex, %complex* %58, i32 0, i32 0 + %48 = load %complex_4, %complex_4* %45, align 4 + %49 = alloca %complex_4, align 8 + store %complex_4 %44, %complex_4* %49, align 4 + %50 = alloca %complex_4, align 8 + store %complex_4 %48, %complex_4* %50, align 4 + %51 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_add(%complex_4* %49, %complex_4* %50, %complex_4* %51) + %52 = load %complex_4, %complex_4* %51, align 4 + %53 = alloca %complex_4, align 8 + store %complex_4 %43, %complex_4* %53, align 4 + %54 = alloca %complex_4, align 8 + store %complex_4 %52, %complex_4* %54, align 4 + %55 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_div(%complex_4* %53, %complex_4* %54, %complex_4* %55) + %56 = load %complex_4, %complex_4* %55, align 4 + store %complex_4 %56, %complex_4* %x, align 4 + %57 = load %complex_4, %complex_4* %x, align 4 + %58 = alloca %complex_4, align 8 + store %complex_4 %57, %complex_4* %58, align 4 + %59 = getelementptr %complex_4, %complex_4* %58, i32 0, i32 0 %60 = load float, float* %59, align 4 %61 = fpext float %60 to double - %62 = alloca %complex, align 8 - store %complex %57, %complex* %62, align 4 - %63 = getelementptr %complex, %complex* %62, i32 0, i32 1 + %62 = alloca %complex_4, align 8 + store %complex_4 %57, %complex_4* %62, align 4 + %63 = getelementptr %complex_4, %complex_4* %62, i32 0, i32 1 %64 = load float, float* %63, align 4 %65 = fpext float %64 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @2, i32 0, i32 0), double %61, double %65) ret i32 0 } -declare void @_lfortran_complex_div(%complex*, %complex*, %complex*, ...) +declare void @_lfortran_complex_div(%complex_4*, %complex_4*, %complex_4*, ...) declare void @_lfortran_printf(i8*, ...) -declare void @_lfortran_complex_add(%complex*, %complex*, %complex*, ...) +declare void @_lfortran_complex_add(%complex_4*, %complex_4*, %complex_4*, ...) diff --git a/tests/reference/llvm-complex_dp-cc3ee95.json b/tests/reference/llvm-complex_dp-cc3ee95.json new file mode 100644 index 0000000000..bc185798b2 --- /dev/null +++ b/tests/reference/llvm-complex_dp-cc3ee95.json @@ -0,0 +1,13 @@ +{ + "basename": "llvm-complex_dp-cc3ee95", + "cmd": "lfortran --show-llvm {infile} -o {outfile}", + "infile": "tests/../integration_tests/complex_dp.f90", + "infile_hash": "2ab8a19155ace703dc52c1f26d2ecea0db08a49637452b31871a40b2", + "outfile": null, + "outfile_hash": null, + "stdout": "llvm-complex_dp-cc3ee95.stdout", + "stdout_hash": "e919ad5b7cf4bb1f15a914b5db141072e5b6b05dea578eac566798c7", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/llvm-complex_dp-cc3ee95.stdout b/tests/reference/llvm-complex_dp-cc3ee95.stdout new file mode 100644 index 0000000000..53b9df5244 --- /dev/null +++ b/tests/reference/llvm-complex_dp-cc3ee95.stdout @@ -0,0 +1,103 @@ +; ModuleID = 'LFortran' +source_filename = "LFortran" + +%complex_8 = type { double, double } +%complex_4 = type { float, float } + +@0 = private unnamed_addr constant [27 x i8] c"(%lf,%lf) (%f,%f) (%f,%f)\0A\00", align 1 + +define i32 @main() { +.entry: + %v = alloca %complex_8, align 8 + %x = alloca %complex_4, align 8 + %zero = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 + store float 0.000000e+00, float* %1, align 4 + store float 0.000000e+00, float* %2, align 4 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %zero, align 4 + %4 = alloca %complex_4, align 8 + %5 = getelementptr %complex_4, %complex_4* %4, i32 0, i32 0 + %6 = getelementptr %complex_4, %complex_4* %4, i32 0, i32 1 + store float 0x3FF0CCCCC0000000, float* %5, align 4 + store float 0x3FF0CCCCC0000000, float* %6, align 4 + %7 = load %complex_4, %complex_4* %4, align 4 + %8 = alloca %complex_4, align 8 + store %complex_4 %7, %complex_4* %8, align 4 + %9 = getelementptr %complex_4, %complex_4* %8, i32 0, i32 0 + %10 = load float, float* %9, align 4 + %11 = fpext float %10 to double + %12 = alloca %complex_4, align 8 + store %complex_4 %7, %complex_4* %12, align 4 + %13 = getelementptr %complex_4, %complex_4* %12, i32 0, i32 1 + %14 = load float, float* %13, align 4 + %15 = fpext float %14 to double + %16 = alloca %complex_8, align 8 + %17 = getelementptr %complex_8, %complex_8* %16, i32 0, i32 0 + %18 = getelementptr %complex_8, %complex_8* %16, i32 0, i32 1 + store double %11, double* %17, align 8 + store double %15, double* %18, align 8 + %19 = load %complex_8, %complex_8* %16, align 8 + store %complex_8 %19, %complex_8* %v, align 8 + %20 = alloca %complex_8, align 8 + %21 = getelementptr %complex_8, %complex_8* %20, i32 0, i32 0 + %22 = getelementptr %complex_8, %complex_8* %20, i32 0, i32 1 + store double 1.050000e+00, double* %21, align 8 + store double 1.050000e+00, double* %22, align 8 + %23 = load %complex_8, %complex_8* %20, align 8 + %24 = alloca %complex_8, align 8 + store %complex_8 %23, %complex_8* %24, align 8 + %25 = getelementptr %complex_8, %complex_8* %24, i32 0, i32 0 + %26 = load double, double* %25, align 8 + %27 = fptrunc double %26 to float + %28 = alloca %complex_8, align 8 + store %complex_8 %23, %complex_8* %28, align 8 + %29 = getelementptr %complex_8, %complex_8* %28, i32 0, i32 1 + %30 = load double, double* %29, align 8 + %31 = fptrunc double %30 to float + %32 = alloca %complex_4, align 8 + %33 = getelementptr %complex_4, %complex_4* %32, i32 0, i32 0 + %34 = getelementptr %complex_4, %complex_4* %32, i32 0, i32 1 + store float %27, float* %33, align 4 + store float %31, float* %34, align 4 + %35 = load %complex_4, %complex_4* %32, align 4 + store %complex_4 %35, %complex_4* %x, align 4 + %36 = load %complex_8, %complex_8* %v, align 8 + %37 = alloca %complex_8, align 8 + store %complex_8 %36, %complex_8* %37, align 8 + %38 = getelementptr %complex_8, %complex_8* %37, i32 0, i32 0 + %39 = load double, double* %38, align 8 + %40 = alloca %complex_8, align 8 + store %complex_8 %36, %complex_8* %40, align 8 + %41 = getelementptr %complex_8, %complex_8* %40, i32 0, i32 1 + %42 = load double, double* %41, align 8 + %43 = load %complex_4, %complex_4* %x, align 4 + %44 = alloca %complex_4, align 8 + store %complex_4 %43, %complex_4* %44, align 4 + %45 = getelementptr %complex_4, %complex_4* %44, i32 0, i32 0 + %46 = load float, float* %45, align 4 + %47 = fpext float %46 to double + %48 = alloca %complex_4, align 8 + store %complex_4 %43, %complex_4* %48, align 4 + %49 = getelementptr %complex_4, %complex_4* %48, i32 0, i32 1 + %50 = load float, float* %49, align 4 + %51 = fpext float %50 to double + %52 = load %complex_4, %complex_4* %zero, align 4 + %53 = alloca %complex_4, align 8 + store %complex_4 %52, %complex_4* %53, align 4 + %54 = getelementptr %complex_4, %complex_4* %53, i32 0, i32 0 + %55 = load float, float* %54, align 4 + %56 = fpext float %55 to double + %57 = alloca %complex_4, align 8 + store %complex_4 %52, %complex_4* %57, align 4 + %58 = getelementptr %complex_4, %complex_4* %57, i32 0, i32 1 + %59 = load float, float* %58, align 4 + %60 = fpext float %59 to double + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @0, i32 0, i32 0), double %39, double %42, double %47, double %51, double %56, double %60) + ret i32 0 +} + +declare void @_lfortran_printf(i8*, ...) + diff --git a/tests/reference/llvm-complex_dp_param-9606a27.json b/tests/reference/llvm-complex_dp_param-9606a27.json new file mode 100644 index 0000000000..a52afc1455 --- /dev/null +++ b/tests/reference/llvm-complex_dp_param-9606a27.json @@ -0,0 +1,13 @@ +{ + "basename": "llvm-complex_dp_param-9606a27", + "cmd": "lfortran --show-llvm {infile} -o {outfile}", + "infile": "tests/../integration_tests/complex_dp_param.f90", + "infile_hash": "0d4d9eaf5bcc2cee6a8b57ee6a66b5a10ced2edf6d64b5d2e2a0bcb8", + "outfile": null, + "outfile_hash": null, + "stdout": "llvm-complex_dp_param-9606a27.stdout", + "stdout_hash": "dbc1e08b51b8b5648acf45094428d3c452b0c0a8659b61a67f489a11", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/llvm-complex_dp_param-9606a27.stdout b/tests/reference/llvm-complex_dp_param-9606a27.stdout new file mode 100644 index 0000000000..b19ddcf531 --- /dev/null +++ b/tests/reference/llvm-complex_dp_param-9606a27.stdout @@ -0,0 +1,89 @@ +; ModuleID = 'LFortran' +source_filename = "LFortran" + +%complex_4 = type { float, float } +%complex_8 = type { double, double } + +@0 = private unnamed_addr constant [29 x i8] c"(%f,%f) (%lf,%lf) (%lf,%lf)\0A\00", align 1 + +define i32 @main() { +.entry: + %prec1 = alloca i32, align 4 + store i32 4, i32* %prec1, align 4 + %prec2 = alloca i32, align 4 + store i32 8, i32* %prec2, align 4 + %u = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 + store float 0x3FF0CCCCC0000000, float* %1, align 4 + store float 0x3FF0CCCCC0000000, float* %2, align 4 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %u, align 4 + %v = alloca %complex_8, align 8 + %4 = alloca %complex_4, align 8 + %5 = getelementptr %complex_4, %complex_4* %4, i32 0, i32 0 + %6 = getelementptr %complex_4, %complex_4* %4, i32 0, i32 1 + store float 0x3FF0CCCCC0000000, float* %5, align 4 + store float 0x3FF0CCCCC0000000, float* %6, align 4 + %7 = load %complex_4, %complex_4* %4, align 4 + %8 = alloca %complex_4, align 8 + store %complex_4 %7, %complex_4* %8, align 4 + %9 = getelementptr %complex_4, %complex_4* %8, i32 0, i32 0 + %10 = load float, float* %9, align 4 + %11 = fpext float %10 to double + %12 = alloca %complex_4, align 8 + store %complex_4 %7, %complex_4* %12, align 4 + %13 = getelementptr %complex_4, %complex_4* %12, i32 0, i32 1 + %14 = load float, float* %13, align 4 + %15 = fpext float %14 to double + %16 = alloca %complex_8, align 8 + %17 = getelementptr %complex_8, %complex_8* %16, i32 0, i32 0 + %18 = getelementptr %complex_8, %complex_8* %16, i32 0, i32 1 + store double %11, double* %17, align 8 + store double %15, double* %18, align 8 + %19 = load %complex_8, %complex_8* %16, align 8 + store %complex_8 %19, %complex_8* %v, align 8 + %zero = alloca %complex_8, align 8 + %20 = alloca %complex_8, align 8 + %21 = getelementptr %complex_8, %complex_8* %20, i32 0, i32 0 + %22 = getelementptr %complex_8, %complex_8* %20, i32 0, i32 1 + store double 0.000000e+00, double* %21, align 8 + store double 0.000000e+00, double* %22, align 8 + %23 = load %complex_8, %complex_8* %20, align 8 + store %complex_8 %23, %complex_8* %zero, align 8 + %24 = load %complex_4, %complex_4* %u, align 4 + %25 = alloca %complex_4, align 8 + store %complex_4 %24, %complex_4* %25, align 4 + %26 = getelementptr %complex_4, %complex_4* %25, i32 0, i32 0 + %27 = load float, float* %26, align 4 + %28 = fpext float %27 to double + %29 = alloca %complex_4, align 8 + store %complex_4 %24, %complex_4* %29, align 4 + %30 = getelementptr %complex_4, %complex_4* %29, i32 0, i32 1 + %31 = load float, float* %30, align 4 + %32 = fpext float %31 to double + %33 = load %complex_8, %complex_8* %v, align 8 + %34 = alloca %complex_8, align 8 + store %complex_8 %33, %complex_8* %34, align 8 + %35 = getelementptr %complex_8, %complex_8* %34, i32 0, i32 0 + %36 = load double, double* %35, align 8 + %37 = alloca %complex_8, align 8 + store %complex_8 %33, %complex_8* %37, align 8 + %38 = getelementptr %complex_8, %complex_8* %37, i32 0, i32 1 + %39 = load double, double* %38, align 8 + %40 = load %complex_8, %complex_8* %zero, align 8 + %41 = alloca %complex_8, align 8 + store %complex_8 %40, %complex_8* %41, align 8 + %42 = getelementptr %complex_8, %complex_8* %41, i32 0, i32 0 + %43 = load double, double* %42, align 8 + %44 = alloca %complex_8, align 8 + store %complex_8 %40, %complex_8* %44, align 8 + %45 = getelementptr %complex_8, %complex_8* %44, i32 0, i32 1 + %46 = load double, double* %45, align 8 + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @0, i32 0, i32 0), double %28, double %32, double %36, double %39, double %43, double %46) + ret i32 0 +} + +declare void @_lfortran_printf(i8*, ...) + diff --git a/tests/reference/llvm-complex_mul_test-69bb29e.json b/tests/reference/llvm-complex_mul_test-69bb29e.json index 883cb28ae0..a5b595b499 100644 --- a/tests/reference/llvm-complex_mul_test-69bb29e.json +++ b/tests/reference/llvm-complex_mul_test-69bb29e.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-complex_mul_test-69bb29e.stdout", - "stdout_hash": "00c242f646e17e82a6883fa568fcc67fa0d7bf8b9b9e1771d52d059e", + "stdout_hash": "9655432792985decc983f23de210b305360e4d71f14f3be4ec4ebe4c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-complex_mul_test-69bb29e.stdout b/tests/reference/llvm-complex_mul_test-69bb29e.stdout index cd99627bdc..fef7222e47 100644 --- a/tests/reference/llvm-complex_mul_test-69bb29e.stdout +++ b/tests/reference/llvm-complex_mul_test-69bb29e.stdout @@ -1,7 +1,7 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -%complex = type { float, float } +%complex_4 = type { float, float } @0 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 @1 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 @@ -9,99 +9,99 @@ source_filename = "LFortran" define i32 @main() { .entry: - %x = alloca %complex, align 8 - %0 = alloca %complex, align 8 - %1 = getelementptr %complex, %complex* %0, i32 0, i32 0 - %2 = getelementptr %complex, %complex* %0, i32 0, i32 1 + %x = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 store float 3.000000e+00, float* %1, align 4 store float 4.000000e+00, float* %2, align 4 - %3 = load %complex, %complex* %0, align 4 - store %complex %3, %complex* %x, align 4 - %4 = load %complex, %complex* %x, align 4 - %5 = alloca %complex, align 8 - %6 = getelementptr %complex, %complex* %5, i32 0, i32 0 - %7 = getelementptr %complex, %complex* %5, i32 0, i32 1 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %x, align 4 + %4 = load %complex_4, %complex_4* %x, align 4 + %5 = alloca %complex_4, align 8 + %6 = getelementptr %complex_4, %complex_4* %5, i32 0, i32 0 + %7 = getelementptr %complex_4, %complex_4* %5, i32 0, i32 1 store float 4.000000e+00, float* %6, align 4 store float 0.000000e+00, float* %7, align 4 - %8 = load %complex, %complex* %5, align 4 - %9 = alloca %complex, align 8 - store %complex %4, %complex* %9, align 4 - %10 = alloca %complex, align 8 - store %complex %8, %complex* %10, align 4 - %11 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_mul(%complex* %9, %complex* %10, %complex* %11) - %12 = load %complex, %complex* %11, align 4 - store %complex %12, %complex* %x, align 4 - %13 = load %complex, %complex* %x, align 4 - %14 = alloca %complex, align 8 - store %complex %13, %complex* %14, align 4 - %15 = getelementptr %complex, %complex* %14, i32 0, i32 0 + %8 = load %complex_4, %complex_4* %5, align 4 + %9 = alloca %complex_4, align 8 + store %complex_4 %4, %complex_4* %9, align 4 + %10 = alloca %complex_4, align 8 + store %complex_4 %8, %complex_4* %10, align 4 + %11 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_mul(%complex_4* %9, %complex_4* %10, %complex_4* %11) + %12 = load %complex_4, %complex_4* %11, align 4 + store %complex_4 %12, %complex_4* %x, align 4 + %13 = load %complex_4, %complex_4* %x, align 4 + %14 = alloca %complex_4, align 8 + store %complex_4 %13, %complex_4* %14, align 4 + %15 = getelementptr %complex_4, %complex_4* %14, i32 0, i32 0 %16 = load float, float* %15, align 4 %17 = fpext float %16 to double - %18 = alloca %complex, align 8 - store %complex %13, %complex* %18, align 4 - %19 = getelementptr %complex, %complex* %18, i32 0, i32 1 + %18 = alloca %complex_4, align 8 + store %complex_4 %13, %complex_4* %18, align 4 + %19 = getelementptr %complex_4, %complex_4* %18, i32 0, i32 1 %20 = load float, float* %19, align 4 %21 = fpext float %20 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @0, i32 0, i32 0), double %17, double %21) - %22 = alloca %complex, align 8 - %23 = getelementptr %complex, %complex* %22, i32 0, i32 0 - %24 = getelementptr %complex, %complex* %22, i32 0, i32 1 + %22 = alloca %complex_4, align 8 + %23 = getelementptr %complex_4, %complex_4* %22, i32 0, i32 0 + %24 = getelementptr %complex_4, %complex_4* %22, i32 0, i32 1 store float 2.000000e+00, float* %23, align 4 store float 0.000000e+00, float* %24, align 4 - %25 = load %complex, %complex* %22, align 4 - %26 = load %complex, %complex* %x, align 4 - %27 = alloca %complex, align 8 - store %complex %25, %complex* %27, align 4 - %28 = alloca %complex, align 8 - store %complex %26, %complex* %28, align 4 - %29 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_mul(%complex* %27, %complex* %28, %complex* %29) - %30 = load %complex, %complex* %29, align 4 - store %complex %30, %complex* %x, align 4 - %31 = load %complex, %complex* %x, align 4 - %32 = alloca %complex, align 8 - store %complex %31, %complex* %32, align 4 - %33 = getelementptr %complex, %complex* %32, i32 0, i32 0 + %25 = load %complex_4, %complex_4* %22, align 4 + %26 = load %complex_4, %complex_4* %x, align 4 + %27 = alloca %complex_4, align 8 + store %complex_4 %25, %complex_4* %27, align 4 + %28 = alloca %complex_4, align 8 + store %complex_4 %26, %complex_4* %28, align 4 + %29 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_mul(%complex_4* %27, %complex_4* %28, %complex_4* %29) + %30 = load %complex_4, %complex_4* %29, align 4 + store %complex_4 %30, %complex_4* %x, align 4 + %31 = load %complex_4, %complex_4* %x, align 4 + %32 = alloca %complex_4, align 8 + store %complex_4 %31, %complex_4* %32, align 4 + %33 = getelementptr %complex_4, %complex_4* %32, i32 0, i32 0 %34 = load float, float* %33, align 4 %35 = fpext float %34 to double - %36 = alloca %complex, align 8 - store %complex %31, %complex* %36, align 4 - %37 = getelementptr %complex, %complex* %36, i32 0, i32 1 + %36 = alloca %complex_4, align 8 + store %complex_4 %31, %complex_4* %36, align 4 + %37 = getelementptr %complex_4, %complex_4* %36, i32 0, i32 1 %38 = load float, float* %37, align 4 %39 = fpext float %38 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @1, i32 0, i32 0), double %35, double %39) - %40 = load %complex, %complex* %x, align 4 - %41 = alloca %complex, align 8 - %42 = getelementptr %complex, %complex* %41, i32 0, i32 0 - %43 = getelementptr %complex, %complex* %41, i32 0, i32 1 + %40 = load %complex_4, %complex_4* %x, align 4 + %41 = alloca %complex_4, align 8 + %42 = getelementptr %complex_4, %complex_4* %41, i32 0, i32 0 + %43 = getelementptr %complex_4, %complex_4* %41, i32 0, i32 1 store float 0.000000e+00, float* %42, align 4 store float 3.000000e+00, float* %43, align 4 - %44 = load %complex, %complex* %41, align 4 - %45 = alloca %complex, align 8 - store %complex %40, %complex* %45, align 4 - %46 = alloca %complex, align 8 - store %complex %44, %complex* %46, align 4 - %47 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_mul(%complex* %45, %complex* %46, %complex* %47) - %48 = load %complex, %complex* %47, align 4 - store %complex %48, %complex* %x, align 4 - %49 = load %complex, %complex* %x, align 4 - %50 = alloca %complex, align 8 - store %complex %49, %complex* %50, align 4 - %51 = getelementptr %complex, %complex* %50, i32 0, i32 0 + %44 = load %complex_4, %complex_4* %41, align 4 + %45 = alloca %complex_4, align 8 + store %complex_4 %40, %complex_4* %45, align 4 + %46 = alloca %complex_4, align 8 + store %complex_4 %44, %complex_4* %46, align 4 + %47 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_mul(%complex_4* %45, %complex_4* %46, %complex_4* %47) + %48 = load %complex_4, %complex_4* %47, align 4 + store %complex_4 %48, %complex_4* %x, align 4 + %49 = load %complex_4, %complex_4* %x, align 4 + %50 = alloca %complex_4, align 8 + store %complex_4 %49, %complex_4* %50, align 4 + %51 = getelementptr %complex_4, %complex_4* %50, i32 0, i32 0 %52 = load float, float* %51, align 4 %53 = fpext float %52 to double - %54 = alloca %complex, align 8 - store %complex %49, %complex* %54, align 4 - %55 = getelementptr %complex, %complex* %54, i32 0, i32 1 + %54 = alloca %complex_4, align 8 + store %complex_4 %49, %complex_4* %54, align 4 + %55 = getelementptr %complex_4, %complex_4* %54, i32 0, i32 1 %56 = load float, float* %55, align 4 %57 = fpext float %56 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @2, i32 0, i32 0), double %53, double %57) ret i32 0 } -declare void @_lfortran_complex_mul(%complex*, %complex*, %complex*, ...) +declare void @_lfortran_complex_mul(%complex_4*, %complex_4*, %complex_4*, ...) declare void @_lfortran_printf(i8*, ...) diff --git a/tests/reference/llvm-complex_pow_test-49d5bfe.json b/tests/reference/llvm-complex_pow_test-49d5bfe.json index b553a7880b..9cc418f5e1 100644 --- a/tests/reference/llvm-complex_pow_test-49d5bfe.json +++ b/tests/reference/llvm-complex_pow_test-49d5bfe.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-complex_pow_test-49d5bfe.stdout", - "stdout_hash": "5bc6a241e5a83fdbeb64fc53ff4c407713ae16beeb87434b4941a814", + "stdout_hash": "a3fd19f18a11f3488d111d9d799408ead2c1bbdb5eb47539127d881a", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-complex_pow_test-49d5bfe.stdout b/tests/reference/llvm-complex_pow_test-49d5bfe.stdout index e50a285bc3..a21960e605 100644 --- a/tests/reference/llvm-complex_pow_test-49d5bfe.stdout +++ b/tests/reference/llvm-complex_pow_test-49d5bfe.stdout @@ -1,55 +1,55 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -%complex = type { float, float } +%complex_4 = type { float, float } @0 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 define i32 @main() { .entry: - %x = alloca %complex, align 8 - %y = alloca %complex, align 8 - %z = alloca %complex, align 8 - %0 = alloca %complex, align 8 - %1 = getelementptr %complex, %complex* %0, i32 0, i32 0 - %2 = getelementptr %complex, %complex* %0, i32 0, i32 1 + %x = alloca %complex_4, align 8 + %y = alloca %complex_4, align 8 + %z = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 store float 3.000000e+00, float* %1, align 4 store float 4.000000e+00, float* %2, align 4 - %3 = load %complex, %complex* %0, align 4 - store %complex %3, %complex* %x, align 4 - %4 = alloca %complex, align 8 - %5 = getelementptr %complex, %complex* %4, i32 0, i32 0 - %6 = getelementptr %complex, %complex* %4, i32 0, i32 1 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %x, align 4 + %4 = alloca %complex_4, align 8 + %5 = getelementptr %complex_4, %complex_4* %4, i32 0, i32 0 + %6 = getelementptr %complex_4, %complex_4* %4, i32 0, i32 1 store float 3.000000e+00, float* %5, align 4 store float 2.000000e+00, float* %6, align 4 - %7 = load %complex, %complex* %4, align 4 - store %complex %7, %complex* %y, align 4 - %8 = load %complex, %complex* %x, align 4 - %9 = load %complex, %complex* %y, align 4 - %10 = alloca %complex, align 8 - store %complex %8, %complex* %10, align 4 - %11 = alloca %complex, align 8 - store %complex %9, %complex* %11, align 4 - %12 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_pow(%complex* %10, %complex* %11, %complex* %12) - %13 = load %complex, %complex* %12, align 4 - store %complex %13, %complex* %z, align 4 - %14 = load %complex, %complex* %z, align 4 - %15 = alloca %complex, align 8 - store %complex %14, %complex* %15, align 4 - %16 = getelementptr %complex, %complex* %15, i32 0, i32 0 + %7 = load %complex_4, %complex_4* %4, align 4 + store %complex_4 %7, %complex_4* %y, align 4 + %8 = load %complex_4, %complex_4* %x, align 4 + %9 = load %complex_4, %complex_4* %y, align 4 + %10 = alloca %complex_4, align 8 + store %complex_4 %8, %complex_4* %10, align 4 + %11 = alloca %complex_4, align 8 + store %complex_4 %9, %complex_4* %11, align 4 + %12 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_pow(%complex_4* %10, %complex_4* %11, %complex_4* %12) + %13 = load %complex_4, %complex_4* %12, align 4 + store %complex_4 %13, %complex_4* %z, align 4 + %14 = load %complex_4, %complex_4* %z, align 4 + %15 = alloca %complex_4, align 8 + store %complex_4 %14, %complex_4* %15, align 4 + %16 = getelementptr %complex_4, %complex_4* %15, i32 0, i32 0 %17 = load float, float* %16, align 4 %18 = fpext float %17 to double - %19 = alloca %complex, align 8 - store %complex %14, %complex* %19, align 4 - %20 = getelementptr %complex, %complex* %19, i32 0, i32 1 + %19 = alloca %complex_4, align 8 + store %complex_4 %14, %complex_4* %19, align 4 + %20 = getelementptr %complex_4, %complex_4* %19, i32 0, i32 1 %21 = load float, float* %20, align 4 %22 = fpext float %21 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @0, i32 0, i32 0), double %18, double %22) ret i32 0 } -declare void @_lfortran_complex_pow(%complex*, %complex*, %complex*, ...) +declare void @_lfortran_complex_pow(%complex_4*, %complex_4*, %complex_4*, ...) declare void @_lfortran_printf(i8*, ...) diff --git a/tests/reference/llvm-complex_sub_test-54e1e68.json b/tests/reference/llvm-complex_sub_test-54e1e68.json index 6d2edf7523..5c420b5046 100644 --- a/tests/reference/llvm-complex_sub_test-54e1e68.json +++ b/tests/reference/llvm-complex_sub_test-54e1e68.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-complex_sub_test-54e1e68.stdout", - "stdout_hash": "4df76e56b357de18373ee54c15edc7815c0f1c2dacf984b6d671793d", + "stdout_hash": "26c31aa1979604ff1da2c254daba4f1bbb622a5e8e79de30111aa95c", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-complex_sub_test-54e1e68.stdout b/tests/reference/llvm-complex_sub_test-54e1e68.stdout index 4457fcd7e4..4939d13393 100644 --- a/tests/reference/llvm-complex_sub_test-54e1e68.stdout +++ b/tests/reference/llvm-complex_sub_test-54e1e68.stdout @@ -1,7 +1,7 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -%complex = type { float, float } +%complex_4 = type { float, float } @0 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 @1 = private unnamed_addr constant [9 x i8] c"(%f,%f)\0A\00", align 1 @@ -9,114 +9,114 @@ source_filename = "LFortran" define i32 @main() { .entry: - %x = alloca %complex, align 8 - %0 = alloca %complex, align 8 - %1 = getelementptr %complex, %complex* %0, i32 0, i32 0 - %2 = getelementptr %complex, %complex* %0, i32 0, i32 1 + %x = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 store float 3.000000e+00, float* %1, align 4 store float 4.000000e+00, float* %2, align 4 - %3 = load %complex, %complex* %0, align 4 - store %complex %3, %complex* %x, align 4 - %4 = load %complex, %complex* %x, align 4 - %5 = alloca %complex, align 8 - %6 = getelementptr %complex, %complex* %5, i32 0, i32 0 - %7 = getelementptr %complex, %complex* %5, i32 0, i32 1 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %x, align 4 + %4 = load %complex_4, %complex_4* %x, align 4 + %5 = alloca %complex_4, align 8 + %6 = getelementptr %complex_4, %complex_4* %5, i32 0, i32 0 + %7 = getelementptr %complex_4, %complex_4* %5, i32 0, i32 1 store float 4.000000e+00, float* %6, align 4 store float 0.000000e+00, float* %7, align 4 - %8 = load %complex, %complex* %5, align 4 - %9 = alloca %complex, align 8 - store %complex %4, %complex* %9, align 4 - %10 = alloca %complex, align 8 - store %complex %8, %complex* %10, align 4 - %11 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_sub(%complex* %9, %complex* %10, %complex* %11) - %12 = load %complex, %complex* %11, align 4 - store %complex %12, %complex* %x, align 4 - %13 = alloca %complex, align 8 - %14 = getelementptr %complex, %complex* %13, i32 0, i32 0 - %15 = getelementptr %complex, %complex* %13, i32 0, i32 1 + %8 = load %complex_4, %complex_4* %5, align 4 + %9 = alloca %complex_4, align 8 + store %complex_4 %4, %complex_4* %9, align 4 + %10 = alloca %complex_4, align 8 + store %complex_4 %8, %complex_4* %10, align 4 + %11 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_sub(%complex_4* %9, %complex_4* %10, %complex_4* %11) + %12 = load %complex_4, %complex_4* %11, align 4 + store %complex_4 %12, %complex_4* %x, align 4 + %13 = alloca %complex_4, align 8 + %14 = getelementptr %complex_4, %complex_4* %13, i32 0, i32 0 + %15 = getelementptr %complex_4, %complex_4* %13, i32 0, i32 1 store float 4.000000e+00, float* %14, align 4 store float 0.000000e+00, float* %15, align 4 - %16 = load %complex, %complex* %13, align 4 - %17 = load %complex, %complex* %x, align 4 - %18 = alloca %complex, align 8 - store %complex %16, %complex* %18, align 4 - %19 = alloca %complex, align 8 - store %complex %17, %complex* %19, align 4 - %20 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_sub(%complex* %18, %complex* %19, %complex* %20) - %21 = load %complex, %complex* %20, align 4 - store %complex %21, %complex* %x, align 4 - %22 = load %complex, %complex* %x, align 4 - %23 = alloca %complex, align 8 - store %complex %22, %complex* %23, align 4 - %24 = getelementptr %complex, %complex* %23, i32 0, i32 0 + %16 = load %complex_4, %complex_4* %13, align 4 + %17 = load %complex_4, %complex_4* %x, align 4 + %18 = alloca %complex_4, align 8 + store %complex_4 %16, %complex_4* %18, align 4 + %19 = alloca %complex_4, align 8 + store %complex_4 %17, %complex_4* %19, align 4 + %20 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_sub(%complex_4* %18, %complex_4* %19, %complex_4* %20) + %21 = load %complex_4, %complex_4* %20, align 4 + store %complex_4 %21, %complex_4* %x, align 4 + %22 = load %complex_4, %complex_4* %x, align 4 + %23 = alloca %complex_4, align 8 + store %complex_4 %22, %complex_4* %23, align 4 + %24 = getelementptr %complex_4, %complex_4* %23, i32 0, i32 0 %25 = load float, float* %24, align 4 %26 = fpext float %25 to double - %27 = alloca %complex, align 8 - store %complex %22, %complex* %27, align 4 - %28 = getelementptr %complex, %complex* %27, i32 0, i32 1 + %27 = alloca %complex_4, align 8 + store %complex_4 %22, %complex_4* %27, align 4 + %28 = getelementptr %complex_4, %complex_4* %27, i32 0, i32 1 %29 = load float, float* %28, align 4 %30 = fpext float %29 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @0, i32 0, i32 0), double %26, double %30) - %31 = alloca %complex, align 8 - %32 = getelementptr %complex, %complex* %31, i32 0, i32 0 - %33 = getelementptr %complex, %complex* %31, i32 0, i32 1 + %31 = alloca %complex_4, align 8 + %32 = getelementptr %complex_4, %complex_4* %31, i32 0, i32 0 + %33 = getelementptr %complex_4, %complex_4* %31, i32 0, i32 1 store float 2.000000e+00, float* %32, align 4 store float 0.000000e+00, float* %33, align 4 - %34 = load %complex, %complex* %31, align 4 - %35 = load %complex, %complex* %x, align 4 - %36 = alloca %complex, align 8 - store %complex %34, %complex* %36, align 4 - %37 = alloca %complex, align 8 - store %complex %35, %complex* %37, align 4 - %38 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_sub(%complex* %36, %complex* %37, %complex* %38) - %39 = load %complex, %complex* %38, align 4 - store %complex %39, %complex* %x, align 4 - %40 = load %complex, %complex* %x, align 4 - %41 = alloca %complex, align 8 - store %complex %40, %complex* %41, align 4 - %42 = getelementptr %complex, %complex* %41, i32 0, i32 0 + %34 = load %complex_4, %complex_4* %31, align 4 + %35 = load %complex_4, %complex_4* %x, align 4 + %36 = alloca %complex_4, align 8 + store %complex_4 %34, %complex_4* %36, align 4 + %37 = alloca %complex_4, align 8 + store %complex_4 %35, %complex_4* %37, align 4 + %38 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_sub(%complex_4* %36, %complex_4* %37, %complex_4* %38) + %39 = load %complex_4, %complex_4* %38, align 4 + store %complex_4 %39, %complex_4* %x, align 4 + %40 = load %complex_4, %complex_4* %x, align 4 + %41 = alloca %complex_4, align 8 + store %complex_4 %40, %complex_4* %41, align 4 + %42 = getelementptr %complex_4, %complex_4* %41, i32 0, i32 0 %43 = load float, float* %42, align 4 %44 = fpext float %43 to double - %45 = alloca %complex, align 8 - store %complex %40, %complex* %45, align 4 - %46 = getelementptr %complex, %complex* %45, i32 0, i32 1 + %45 = alloca %complex_4, align 8 + store %complex_4 %40, %complex_4* %45, align 4 + %46 = getelementptr %complex_4, %complex_4* %45, i32 0, i32 1 %47 = load float, float* %46, align 4 %48 = fpext float %47 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @1, i32 0, i32 0), double %44, double %48) - %49 = load %complex, %complex* %x, align 4 - %50 = alloca %complex, align 8 - %51 = getelementptr %complex, %complex* %50, i32 0, i32 0 - %52 = getelementptr %complex, %complex* %50, i32 0, i32 1 + %49 = load %complex_4, %complex_4* %x, align 4 + %50 = alloca %complex_4, align 8 + %51 = getelementptr %complex_4, %complex_4* %50, i32 0, i32 0 + %52 = getelementptr %complex_4, %complex_4* %50, i32 0, i32 1 store float 0.000000e+00, float* %51, align 4 store float 3.000000e+00, float* %52, align 4 - %53 = load %complex, %complex* %50, align 4 - %54 = alloca %complex, align 8 - store %complex %49, %complex* %54, align 4 - %55 = alloca %complex, align 8 - store %complex %53, %complex* %55, align 4 - %56 = alloca %complex, align 8 - call void (%complex*, %complex*, %complex*, ...) @_lfortran_complex_sub(%complex* %54, %complex* %55, %complex* %56) - %57 = load %complex, %complex* %56, align 4 - store %complex %57, %complex* %x, align 4 - %58 = load %complex, %complex* %x, align 4 - %59 = alloca %complex, align 8 - store %complex %58, %complex* %59, align 4 - %60 = getelementptr %complex, %complex* %59, i32 0, i32 0 + %53 = load %complex_4, %complex_4* %50, align 4 + %54 = alloca %complex_4, align 8 + store %complex_4 %49, %complex_4* %54, align 4 + %55 = alloca %complex_4, align 8 + store %complex_4 %53, %complex_4* %55, align 4 + %56 = alloca %complex_4, align 8 + call void (%complex_4*, %complex_4*, %complex_4*, ...) @_lfortran_complex_sub(%complex_4* %54, %complex_4* %55, %complex_4* %56) + %57 = load %complex_4, %complex_4* %56, align 4 + store %complex_4 %57, %complex_4* %x, align 4 + %58 = load %complex_4, %complex_4* %x, align 4 + %59 = alloca %complex_4, align 8 + store %complex_4 %58, %complex_4* %59, align 4 + %60 = getelementptr %complex_4, %complex_4* %59, i32 0, i32 0 %61 = load float, float* %60, align 4 %62 = fpext float %61 to double - %63 = alloca %complex, align 8 - store %complex %58, %complex* %63, align 4 - %64 = getelementptr %complex, %complex* %63, i32 0, i32 1 + %63 = alloca %complex_4, align 8 + store %complex_4 %58, %complex_4* %63, align 4 + %64 = getelementptr %complex_4, %complex_4* %63, i32 0, i32 1 %65 = load float, float* %64, align 4 %66 = fpext float %65 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @2, i32 0, i32 0), double %62, double %66) ret i32 0 } -declare void @_lfortran_complex_sub(%complex*, %complex*, %complex*, ...) +declare void @_lfortran_complex_sub(%complex_4*, %complex_4*, %complex_4*, ...) declare void @_lfortran_printf(i8*, ...) diff --git a/tests/reference/llvm-global_scope8-7b2dfc5.json b/tests/reference/llvm-global_scope8-7b2dfc5.json new file mode 100644 index 0000000000..121cf5cc19 --- /dev/null +++ b/tests/reference/llvm-global_scope8-7b2dfc5.json @@ -0,0 +1,13 @@ +{ + "basename": "llvm-global_scope8-7b2dfc5", + "cmd": "lfortran --show-llvm {infile} -o {outfile}", + "infile": "tests/global_scope8.f90", + "infile_hash": "899df30dee274279a699110fb9af2afad0b826c0abc886f9e2460627", + "outfile": null, + "outfile_hash": null, + "stdout": "llvm-global_scope8-7b2dfc5.stdout", + "stdout_hash": "85ac35b60c43217b2e8277201cc35c1c55af4e454798446d7165ea80", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/llvm-global_scope8-7b2dfc5.stdout b/tests/reference/llvm-global_scope8-7b2dfc5.stdout new file mode 100644 index 0000000000..16a625bbbb --- /dev/null +++ b/tests/reference/llvm-global_scope8-7b2dfc5.stdout @@ -0,0 +1,15 @@ +; ModuleID = 'LFortran' +source_filename = "LFortran" + +@x = global i32 0 + +define i32 @f() { +.entry: + %f1 = alloca i32, align 4 + store i32 6, i32* @x, align 4 + %0 = load i32, i32* @x, align 4 + store i32 %0, i32* %f1, align 4 + %1 = load i32, i32* %f1, align 4 + ret i32 %1 +} + diff --git a/tests/reference/llvm-global_scope9-a9756a7.json b/tests/reference/llvm-global_scope9-a9756a7.json new file mode 100644 index 0000000000..60acceb77d --- /dev/null +++ b/tests/reference/llvm-global_scope9-a9756a7.json @@ -0,0 +1,13 @@ +{ + "basename": "llvm-global_scope9-a9756a7", + "cmd": "lfortran --show-llvm {infile} -o {outfile}", + "infile": "tests/global_scope9.f90", + "infile_hash": "29e87c62bbe7f9efedd2e3cf348e80153367ecc0369b16de6f4db296", + "outfile": null, + "outfile_hash": null, + "stdout": "llvm-global_scope9-a9756a7.stdout", + "stdout_hash": "c7dbfb78686c4b4569ac8d1d9859443067bf7829c1b159f4bf5c29b3", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/llvm-global_scope9-a9756a7.stdout b/tests/reference/llvm-global_scope9-a9756a7.stdout new file mode 100644 index 0000000000..41dee1b689 --- /dev/null +++ b/tests/reference/llvm-global_scope9-a9756a7.stdout @@ -0,0 +1,15 @@ +; ModuleID = 'LFortran' +source_filename = "LFortran" + +@x = global i64 0 + +define i64 @f() { +.entry: + %f1 = alloca i64, align 8 + store i64 6, i64* @x, align 4 + %0 = load i64, i64* @x, align 4 + store i64 %0, i64* %f1, align 4 + %1 = load i64, i64* %f1, align 4 + ret i64 %1 +} + diff --git a/tests/reference/llvm-init_values-e37737a.json b/tests/reference/llvm-init_values-e37737a.json index 728dc2ad95..21e9cd8796 100644 --- a/tests/reference/llvm-init_values-e37737a.json +++ b/tests/reference/llvm-init_values-e37737a.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-init_values-e37737a.stdout", - "stdout_hash": "eceb93bc33480c2606f07422a9fefd54485d713f6006899fa3fa9298", + "stdout_hash": "c839fd8ac1d249ae734c29479eaa7e86082ad70687dbbb06ef84681d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-init_values-e37737a.stdout b/tests/reference/llvm-init_values-e37737a.stdout index bd681d2159..e54f6a98e2 100644 --- a/tests/reference/llvm-init_values-e37737a.stdout +++ b/tests/reference/llvm-init_values-e37737a.stdout @@ -1,20 +1,20 @@ ; ModuleID = 'LFortran' source_filename = "LFortran" -%complex = type { float, float } +%complex_4 = type { float, float } @0 = private unnamed_addr constant [15 x i8] c"%d %f (%f,%f)\0A\00", align 1 define i32 @main() { .entry: - %c = alloca %complex, align 8 - %0 = alloca %complex, align 8 - %1 = getelementptr %complex, %complex* %0, i32 0, i32 0 - %2 = getelementptr %complex, %complex* %0, i32 0, i32 1 + %c = alloca %complex_4, align 8 + %0 = alloca %complex_4, align 8 + %1 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 0 + %2 = getelementptr %complex_4, %complex_4* %0, i32 0, i32 1 store float 3.000000e+00, float* %1, align 4 store float 4.000000e+00, float* %2, align 4 - %3 = load %complex, %complex* %0, align 4 - store %complex %3, %complex* %c, align 4 + %3 = load %complex_4, %complex_4* %0, align 4 + store %complex_4 %3, %complex_4* %c, align 4 %i = alloca i32, align 4 store i32 1, i32* %i, align 4 %r = alloca float, align 4 @@ -22,15 +22,15 @@ define i32 @main() { %4 = load i32, i32* %i, align 4 %5 = load float, float* %r, align 4 %6 = fpext float %5 to double - %7 = load %complex, %complex* %c, align 4 - %8 = alloca %complex, align 8 - store %complex %7, %complex* %8, align 4 - %9 = getelementptr %complex, %complex* %8, i32 0, i32 0 + %7 = load %complex_4, %complex_4* %c, align 4 + %8 = alloca %complex_4, align 8 + store %complex_4 %7, %complex_4* %8, align 4 + %9 = getelementptr %complex_4, %complex_4* %8, i32 0, i32 0 %10 = load float, float* %9, align 4 %11 = fpext float %10 to double - %12 = alloca %complex, align 8 - store %complex %7, %complex* %12, align 4 - %13 = getelementptr %complex, %complex* %12, i32 0, i32 1 + %12 = alloca %complex_4, align 8 + store %complex_4 %7, %complex_4* %12, align 4 + %13 = getelementptr %complex_4, %complex_4* %12, i32 0, i32 1 %14 = load float, float* %13, align 4 %15 = fpext float %14 to double call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @0, i32 0, i32 0), i32 %4, double %6, double %11, double %15) diff --git a/tests/reference/llvm-modules_01-8087933.json b/tests/reference/llvm-modules_01-8087933.json index a526301bb3..63964fc2cf 100644 --- a/tests/reference/llvm-modules_01-8087933.json +++ b/tests/reference/llvm-modules_01-8087933.json @@ -2,11 +2,11 @@ "basename": "llvm-modules_01-8087933", "cmd": "lfortran --show-llvm {infile} -o {outfile}", "infile": "tests/../integration_tests/modules_01.f90", - "infile_hash": "697383eb5d15cbcf71af84f8421bbe2d4e7a7d094c24b90d5b0c4678", + "infile_hash": "17c761eb72726e0dde59f2b21f98f2402d783613834e927c49047534", "outfile": null, "outfile_hash": null, "stdout": "llvm-modules_01-8087933.stdout", - "stdout_hash": "36a84cda035425b03ad7e187702c06e1851d1b01efee66686c0594de", + "stdout_hash": "a641ccc60e7bec8ebd4c5b783d9ac6d72377366021f00b446510d2d3", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-modules_01-8087933.stdout b/tests/reference/llvm-modules_01-8087933.stdout index 275a0a60aa..342a00cacb 100644 --- a/tests/reference/llvm-modules_01-8087933.stdout +++ b/tests/reference/llvm-modules_01-8087933.stdout @@ -4,7 +4,7 @@ source_filename = "LFortran" @0 = private unnamed_addr constant [4 x i8] c"b()\00", align 1 @1 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 -define void @__module_a_b() { +define void @__module_a_01_b() { .entry: call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i32 0, i32 0)) ret void @@ -14,7 +14,7 @@ declare void @_lfortran_printf(i8*, ...) define i32 @main() { .entry: - call void @__module_a_b() + call void @__module_a_01_b() ret i32 0 } diff --git a/tests/reference/llvm-modules_06-d88da6b.json b/tests/reference/llvm-modules_06-d88da6b.json index aadb8b787f..bfc60ca254 100644 --- a/tests/reference/llvm-modules_06-d88da6b.json +++ b/tests/reference/llvm-modules_06-d88da6b.json @@ -2,11 +2,11 @@ "basename": "llvm-modules_06-d88da6b", "cmd": "lfortran --show-llvm {infile} -o {outfile}", "infile": "tests/../integration_tests/modules_06.f90", - "infile_hash": "b557e356e3fb2b4c6c9592afc7b92c2f7ab6faa135823569d9ab079d", + "infile_hash": "5c41285ce39e1fc24c7cb3c89e4638d3a606e5d2c48a470da7a245b7", "outfile": null, "outfile_hash": null, "stdout": "llvm-modules_06-d88da6b.stdout", - "stdout_hash": "06e6565924f966fa698114c68e1565ed63ad7ddb04bd25844ef64eb6", + "stdout_hash": "221485fd4b3b2604c18059ef37f611a023030d5945b4c02f1b16d095", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-modules_06-d88da6b.stdout b/tests/reference/llvm-modules_06-d88da6b.stdout index 2f1d42e3a5..c495b05b61 100644 --- a/tests/reference/llvm-modules_06-d88da6b.stdout +++ b/tests/reference/llvm-modules_06-d88da6b.stdout @@ -5,7 +5,7 @@ source_filename = "LFortran" @1 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1 @2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 -define i32 @__module_a_b() { +define i32 @__module_a_06_b() { .entry: %r = alloca i32, align 4 call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i32 0, i32 0)) @@ -19,7 +19,7 @@ declare void @_lfortran_printf(i8*, ...) define i32 @main() { .entry: %i = alloca i32, align 4 - %0 = call i32 @__module_a_b() + %0 = call i32 @__module_a_06_b() store i32 %0, i32* %i, align 4 %1 = load i32, i32* %i, align 4 call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @2, i32 0, i32 0), i32 %1) diff --git a/tests/reference/pass_do_loops-doloop_01-f2f0442.json b/tests/reference/pass_do_loops-doloop_01-f2f0442.json index 495f682c58..aace38a273 100644 --- a/tests/reference/pass_do_loops-doloop_01-f2f0442.json +++ b/tests/reference/pass_do_loops-doloop_01-f2f0442.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "pass_do_loops-doloop_01-f2f0442.stdout", - "stdout_hash": "f5a7e14144a54293ec316fccc68c5856416e7b60327c85d600c78dad", + "stdout_hash": "74e832e1d6796584588f530810a7d66b252e45130d045b0e1168765f", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/pass_do_loops-doloop_01-f2f0442.stdout b/tests/reference/pass_do_loops-doloop_01-f2f0442.stdout index e0ff69025a..a49934a29e 100644 --- a/tests/reference/pass_do_loops-doloop_01-f2f0442.stdout +++ b/tests/reference/pass_do_loops-doloop_01-f2f0442.stdout @@ -1 +1 @@ -(TranslationUnit (SymbolTable 1 {doloop_01: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) doloop_01 [(= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 10 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 10 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 9 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 9 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 10 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 10 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 3 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 22 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 10 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 22 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 0 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 0 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) +(TranslationUnit (SymbolTable 1 {doloop_01: (Program (SymbolTable 2 {i: (Variable 2 i Local () Default (Integer 4 []) Source Public), j: (Variable 2 j Local () Default (Integer 4 []) Source Public)}) doloop_01 [] [(= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 10 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 10 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 55 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 9 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 9 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 10 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 2 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 25 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 3 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 10 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 3 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 22 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 10 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 3 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 22 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 1 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 1 (Integer 4 [])) Sub (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) LtE (ConstantInteger 0 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (ConstantInteger 1 (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] []) (= (Var 2 j) (ConstantInteger 0 (Integer 4 []))) (= (Var 2 i) (BinOp (ConstantInteger 0 (Integer 4 [])) Sub (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (WhileLoop (Compare (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 [])) GtE (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) [(= (Var 2 i) (BinOp (Var 2 i) Add (UnaryOp USub (ConstantInteger 1 (Integer 4 [])) (Integer 4 [])) (Integer 4 []))) (= (Var 2 j) (BinOp (Var 2 j) Add (Var 2 i) (Integer 4 [])))]) (If (Compare (Var 2 j) NotEq (ConstantInteger 0 (Integer 4 [])) (Logical 4 [])) [(ErrorStop ())] [])])}) []) diff --git a/tests/reference/pass_global_stmts-global_scope8-95c3673.json b/tests/reference/pass_global_stmts-global_scope8-95c3673.json new file mode 100644 index 0000000000..7145625096 --- /dev/null +++ b/tests/reference/pass_global_stmts-global_scope8-95c3673.json @@ -0,0 +1,13 @@ +{ + "basename": "pass_global_stmts-global_scope8-95c3673", + "cmd": "lfortran --pass=global_stmts --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/global_scope8.f90", + "infile_hash": "899df30dee274279a699110fb9af2afad0b826c0abc886f9e2460627", + "outfile": null, + "outfile_hash": null, + "stdout": "pass_global_stmts-global_scope8-95c3673.stdout", + "stdout_hash": "18e01632336236dbe4c2c486a44ff48abe718c12f41c4f7ad2fc340a", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/pass_global_stmts-global_scope8-95c3673.stdout b/tests/reference/pass_global_stmts-global_scope8-95c3673.stdout new file mode 100644 index 0000000000..e18768792b --- /dev/null +++ b/tests/reference/pass_global_stmts-global_scope8-95c3673.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {f: (Function (SymbolTable 2 {f1: (Variable 2 f1 ReturnVar () Default (Integer 4 []) Source Public)}) f [] [(= (Var 1 x) (ConstantInteger 6 (Integer 4 []))) (= (Var 2 f1) (Var 1 x))] (Var 2 f1) Source Public), x: (Variable 1 x Local () Default (Integer 4 []) Source Public)}) []) diff --git a/tests/reference/pass_global_stmts-global_scope9-4cbbc3e.json b/tests/reference/pass_global_stmts-global_scope9-4cbbc3e.json new file mode 100644 index 0000000000..c1780f1c6e --- /dev/null +++ b/tests/reference/pass_global_stmts-global_scope9-4cbbc3e.json @@ -0,0 +1,13 @@ +{ + "basename": "pass_global_stmts-global_scope9-4cbbc3e", + "cmd": "lfortran --pass=global_stmts --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/global_scope9.f90", + "infile_hash": "29e87c62bbe7f9efedd2e3cf348e80153367ecc0369b16de6f4db296", + "outfile": null, + "outfile_hash": null, + "stdout": "pass_global_stmts-global_scope9-4cbbc3e.stdout", + "stdout_hash": "d8fab15ef44382a7480126f4cbd5ccc01354ac1269200473486cd4aa", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/pass_global_stmts-global_scope9-4cbbc3e.stdout b/tests/reference/pass_global_stmts-global_scope9-4cbbc3e.stdout new file mode 100644 index 0000000000..14a0271b18 --- /dev/null +++ b/tests/reference/pass_global_stmts-global_scope9-4cbbc3e.stdout @@ -0,0 +1 @@ +(TranslationUnit (SymbolTable 1 {f: (Function (SymbolTable 2 {f1: (Variable 2 f1 ReturnVar () Default (Integer 8 []) Source Public)}) f [] [(= (Var 1 x) (ImplicitCast (ConstantInteger 6 (Integer 4 [])) IntegerToInteger (Integer 8 []))) (= (Var 2 f1) (Var 1 x))] (Var 2 f1) Source Public), x: (Variable 1 x Local () Default (Integer 8 []) Source Public)}) []) diff --git a/tests/tests.toml b/tests/tests.toml index 2f90a389c7..cfb1b8f325 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -259,6 +259,18 @@ asr = true llvm = true pass = "global_stmts" +[[test]] +filename = "global_scope8.f90" +asr = true +llvm = true +pass = "global_stmts" + +[[test]] +filename = "global_scope9.f90" +asr = true +llvm = true +pass = "global_stmts" + [[test]] filename = "kokkos_program1.f90" cpp = true @@ -324,6 +336,10 @@ asr = true cpp = true llvm = true +[[test]] +filename = "../integration_tests/arrays_06.f90" +ast = true + [[test]] filename = "../integration_tests/arrays_07.f90" asr = true @@ -480,7 +496,8 @@ llvm = true [[test]] filename = "../integration_tests/allocate_01.f90" -asr = true +ast = true +ast_f90 = true [[test]] filename = "../integration_tests/block_01.f90" @@ -488,7 +505,7 @@ ast = true [[test]] filename = "../integration_tests/associate_01.f90" -asr = true +ast = true [[test]] filename = "../integration_tests/associate_02.f90" @@ -578,6 +595,10 @@ ast_f90 = true filename = "do_concurrent1.f90" ast = true +[[test]] +filename = "../integration_tests/doconcurrentloop_01.f90" +ast_f90 = true + [[test]] filename = "subroutine9.f90" ast = true @@ -715,6 +736,21 @@ filename = "../integration_tests/int_dp_param.f90" asr = true llvm = true +[[test]] +filename = "../integration_tests/complex_dp.f90" +asr = true +llvm = true + +[[test]] +filename = "../integration_tests/complex_dp_param.f90" +asr = true +llvm = true + +[[test]] +filename = "../integration_tests/bin_op_complex_dp.f90" +asr = true +llvm = true + # sin [[test]] filename = "../integration_tests/intrinsics_02.f90" @@ -766,6 +802,11 @@ ast_f90 = true filename = "modules_05.f90" asr = true +[[test]] +filename = "modules_06.f90" +ast = true +asr = true + [[test]] filename = "../integration_tests/string1.f90" ast = true