Skip to content

Commit aa5b859

Browse files
committed
wip
1 parent 53d93de commit aa5b859

20 files changed

+28
-24
lines changed

src/bin/lpython.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,8 @@ int compile_python_to_object_file(
540540
diagnostics.diagnostics.clear();
541541
auto ast_to_asr_start = std::chrono::high_resolution_clock::now();
542542
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
543-
r1 = LFortran::LPython::python_ast_to_asr(al, *ast, diagnostics, !arg_c,
543+
r1 = LFortran::LPython::python_ast_to_asr(al, *ast, diagnostics,
544+
!(arg_c && compiler_options.disable_main),
544545
compiler_options.disable_main, compiler_options.symtab_only, infile);
545546
auto ast_to_asr_end = std::chrono::high_resolution_clock::now();
546547
times.push_back(std::make_pair("AST to ASR", std::chrono::duration<double, std::milli>(ast_to_asr_end - ast_to_asr_start).count()));
@@ -551,7 +552,7 @@ int compile_python_to_object_file(
551552
return 2;
552553
}
553554
LFortran::ASR::TranslationUnit_t* asr = r1.result;
554-
{
555+
if( compiler_options.disable_main ) {
555556
int err = LFortran::LPython::save_pyc_files(*asr, infile);
556557
if( err ) {
557558
return err;

src/lpython/semantics/python_ast_to_asr.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <lpython/semantics/python_comptime_eval.h>
2929
#include <lpython/semantics/python_attribute_eval.h>
3030
#include <lpython/parser/parser.h>
31+
#include <libasr/serialization.h>
3132

3233

3334
namespace LFortran::LPython {
@@ -241,7 +242,10 @@ ASR::TranslationUnit_t* compile_module_till_asr(Allocator& al,
241242
lm.in_filename = infile;
242243
Result<ASR::TranslationUnit_t*> r2 = python_ast_to_asr(al, *ast,
243244
diagnostics, false, true, false, infile);
244-
save_pyc_files(*r2.result, infile + "c");
245+
// TODO: Uncomment once a check is added for ensuring
246+
// that module.py file hasn't changed between
247+
// builds.
248+
// save_pyc_files(*r2.result, infile + "c");
245249
std::string input;
246250
read_file(infile, input);
247251
CompilerOptions compiler_options;
@@ -284,15 +288,14 @@ ASR::Module_t* load_module(Allocator &al, SymbolTable *symtab,
284288
std::string input;
285289
bool found = set_module_path(infile0c, rl_path, infile,
286290
path_used, input, ltypes);
287-
std::cout<<"infile0c: "<<infile0c<<" "<<found<<std::endl;
288291
if( !found ) {
289292
input.clear();
290293
found = set_module_path(infile0, rl_path, infile,
291294
path_used, input, ltypes);
292295
} else {
293-
std::cout<<"loading_pyc_file: "<<std::endl;
294296
mod1 = load_pycfile(al, input, false);
295-
std::cout<<"loaded_pyc_file: "<<std::endl;
297+
fix_external_symbols(*mod1, *ASRUtils::get_tu_symtab(symtab));
298+
LFORTRAN_ASSERT(asr_verify(*mod1));
296299
compile_module = false;
297300
}
298301

tests/reference/asr-array_01_decl-39cf894.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-array_01_decl-39cf894.stdout",
9-
"stdout_hash": "2f0124ba9707dd821038eb87ad69e5cc077bf9813b2ee9c485f8d622",
9+
"stdout_hash": "1f4709dd52ce1b5d05fbb2d9b9bf62cba476b7dcbd499f72d19bfeaa",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

tests/reference/asr-array_01_decl-39cf894.stdout

+1-1
Large diffs are not rendered by default.

tests/reference/asr-array_02_decl-e8f6874.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-array_02_decl-e8f6874.stdout",
9-
"stdout_hash": "3e3019fdfecd2dd3330e1aba33adf5dece062d099f114b65fec15a05",
9+
"stdout_hash": "59173049eeb2ac310c938c3996c0ce4d3e6aed5220cd81f450cbce03",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

tests/reference/asr-array_02_decl-e8f6874.stdout

+1-1
Large diffs are not rendered by default.

tests/reference/asr-elemental_01-b58df26.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-elemental_01-b58df26.stdout",
9-
"stdout_hash": "5fc78320eb9743ff65e96fbbf6c34b2750bc410cddaf37423c06f313",
9+
"stdout_hash": "771b91f56b094a1f2634e48e2e6cbcc670940d84ece5f5ac3ad86ea0",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

tests/reference/asr-elemental_01-b58df26.stdout

+1-1
Large diffs are not rendered by default.

tests/reference/asr-expr_09-f3e89c8.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-expr_09-f3e89c8.stdout",
9-
"stdout_hash": "66cf441a7ed60ad292ae9933ae51d8aac76f803201b809eac2689a33",
9+
"stdout_hash": "b25ac596c0befdb4c50e811a946f8ab74e0924c720fe55eea2d72599",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Function (SymbolTable 86 {}) _lpython_main_program [] [] [(SubroutineCall 1 test_multiple_assign_1 () [] ()) (SubroutineCall 1 test_issue_928 () [] ()) (SubroutineCall 1 main0 () [] ())] () Source Public Implementation () .false. .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 6 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main0: (Function (SymbolTable 2 {i1: (Variable 2 i1 Local () () Default (Integer 4 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 4 []) Source Public Required .false.)}) main0 [] [] [(= (Var 2 i1) (IntegerConstant 10 (Integer 4 [])) ()) (= (Var 2 i2) (IntegerConstant 4 (Integer 4 [])) ()) (= (Var 2 i1) (IntegerConstant 3 (Integer 4 [])) ()) (= (Var 2 i2) (IntegerConstant 5 (Integer 4 [])) ()) (Print () [(IntegerBinOp (IntegerUnaryMinus (Var 2 i1) (Integer 4 []) ()) BitXor (IntegerUnaryMinus (Var 2 i2) (Integer 4 []) ()) (Integer 4 []) ())] () ()) (Assert (IntegerCompare (IntegerBinOp (IntegerUnaryMinus (Var 2 i1) (Integer 4 []) ()) BitXor (IntegerUnaryMinus (Var 2 i2) (Integer 4 []) ()) (Integer 4 []) ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) ()) ())] () Source Public Implementation () .false. .false. .false.), main_program: (Program (SymbolTable 85 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_issue_928: (Function (SymbolTable 4 {a: (Variable 4 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 4 b Local () () Default (Integer 4 []) Source Public Required .false.), c: (Variable 4 c Local () () Default (Tuple [(Integer 4 []) (Integer 4 [])]) Source Public Required .false.)}) test_issue_928 [] [] [(= (TupleConstant [(Var 4 a) (Var 4 b)] (Tuple [(Integer 4 []) (Integer 4 [])])) (TupleConstant [(IntegerConstant 2 (Integer 4 [])) (IntegerConstant 1 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 4 c) (TupleConstant [(IntegerConstant 2 (Integer 4 [])) (IntegerConstant 1 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (Assert (IntegerCompare (Var 4 a) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) ()) ()) (Assert (IntegerCompare (Var 4 b) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) ()) ()) (Assert (LogicalBinOp (IntegerCompare (TupleItem (Var 4 c) (IntegerConstant 0 (Integer 4 [])) (Integer 4 []) ()) Eq (Var 4 a) (Logical 4 []) ()) And (IntegerCompare (TupleItem (Var 4 c) (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) ()) Eq (Var 4 b) (Logical 4 []) ()) (Logical 4 []) ()) ())] () Source Public Implementation () .false. .false. .false.), test_multiple_assign_1: (Function (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), abs: (ExternalSymbol 3 abs 6 abs lpython_builtin [] abs Private), b: (Variable 3 b Local () () Default (Integer 4 []) Source Public Required .false.), c: (Variable 3 c Local () () Default (Integer 4 []) Source Public Required .false.), d: (Variable 3 d Local () () Default (Real 8 []) Source Public Required .false.), e: (Variable 3 e Local () () Default (Real 4 []) Source Public Required .false.), g: (Variable 3 g Local () () Default (Integer 4 []) Source Public Required .false.), i: (Variable 3 i Local () () Default (List (Real 8 [])) Source Public Required .false.), j: (Variable 3 j Local () () Default (List (Real 8 [])) Source Public Required .false.), k: (Variable 3 k Local () () Default (List (Real 8 [])) Source Public Required .false.), x: (Variable 3 x Local () () Default (Real 4 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Real 8 []) Source Public Required .false.)}) test_multiple_assign_1 [] [] [(= (Var 3 g) (IntegerConstant 5 (Integer 4 [])) ()) (= (Var 3 d) (RealBinOp (Cast (Var 3 g) IntegerToReal (Real 8 []) ()) Add (RealConstant 1.000000 (Real 8 [])) (Real 8 []) ()) ()) (= (Var 3 e) (Cast (RealBinOp (Cast (Var 3 g) IntegerToReal (Real 8 []) ()) Add (RealConstant 1.000000 (Real 8 [])) (Real 8 []) ()) RealToReal (Real 4 []) ()) ()) (= (Var 3 a) (IntegerConstant 10 (Integer 4 [])) ()) (= (Var 3 b) (IntegerConstant 10 (Integer 4 [])) ()) (= (Var 3 c) (IntegerConstant 10 (Integer 4 [])) ()) (Assert (IntegerCompare (Var 3 a) Eq (Var 3 b) (Logical 4 []) ()) ()) (Assert (IntegerCompare (Var 3 b) Eq (Var 3 c) (Logical 4 []) ()) ()) (Assert (IntegerCompare (Var 3 a) Eq (IntegerConstant 10 (Integer 4 [])) (Logical 4 []) ()) ()) (= (Var 3 x) (Cast (RealConstant 23.000000 (Real 8 [])) RealToReal (Real 4 []) (RealConstant 23.000000 (Real 4 []))) ()) (= (Var 3 y) (RealConstant 23.000000 (Real 8 [])) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (Cast (Var 3 x) RealToReal (Real 8 []) ()) Sub (RealConstant 23.000000 (Real 8 [])) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000001 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (Var 3 y) Sub (RealConstant 23.000000 (Real 8 [])) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (Cast (Var 3 e) RealToReal (Real 8 []) ()) Sub (RealConstant 6.000000 (Real 8 [])) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000001 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (Var 3 d) Sub (RealConstant 6.000000 (Real 8 [])) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ()) (= (Var 3 k) (ListConstant [] (List (Real 8 []))) ()) (= (Var 3 g) (IntegerConstant 0 (Integer 4 [])) ()) (DoLoop ((Var 3 g) (IntegerConstant 0 (Integer 4 [])) (IntegerBinOp (IntegerConstant 10 (Integer 4 [])) Sub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant 9 (Integer 4 []))) (IntegerConstant 1 (Integer 4 []))) [(ListAppend (Var 3 k) (RealBinOp (RealBinOp (Cast (Var 3 g) IntegerToReal (Real 8 []) ()) Mul (RealConstant 2.000000 (Real 8 [])) (Real 8 []) ()) Add (RealConstant 5.000000 (Real 8 [])) (Real 8 []) ()))]) (= (Var 3 i) (Var 3 k) ()) (= (Var 3 j) (Var 3 k) ()) (DoLoop ((Var 3 g) (IntegerConstant 0 (Integer 4 [])) (IntegerBinOp (IntegerConstant 10 (Integer 4 [])) Sub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant 9 (Integer 4 []))) (IntegerConstant 1 (Integer 4 []))) [(Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (ListItem (Var 3 i) (Var 3 g) (Real 8 []) ()) Sub (ListItem (Var 3 j) (Var 3 g) (Real 8 []) ()) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (ListItem (Var 3 i) (Var 3 g) (Real 8 []) ()) Sub (ListItem (Var 3 k) (Var 3 g) (Real 8 []) ()) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (RealBinOp (RealBinOp (Cast (Var 3 g) IntegerToReal (Real 8 []) ()) Mul (RealConstant 2.000000 (Real 8 [])) (Real 8 []) ()) Add (RealConstant 5.000000 (Real 8 [])) (Real 8 []) ()) Sub (ListItem (Var 3 k) (Var 3 g) (Real 8 []) ()) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ())])] () Source Public Implementation () .false. .false. .false.)}) [])
1+
(TranslationUnit (SymbolTable 1 {_lpython_main_program: (Function (SymbolTable 89 {}) _lpython_main_program [] [] [(SubroutineCall 1 test_multiple_assign_1 () [] ()) (SubroutineCall 1 test_issue_928 () [] ()) (SubroutineCall 1 main0 () [] ())] () Source Public Implementation () .false. .false. .false.), abs@__lpython_overloaded_0__abs: (ExternalSymbol 1 abs@__lpython_overloaded_0__abs 6 __lpython_overloaded_0__abs lpython_builtin [] __lpython_overloaded_0__abs Public), lpython_builtin: (IntrinsicModule lpython_builtin), main0: (Function (SymbolTable 2 {i1: (Variable 2 i1 Local () () Default (Integer 4 []) Source Public Required .false.), i2: (Variable 2 i2 Local () () Default (Integer 4 []) Source Public Required .false.)}) main0 [] [] [(= (Var 2 i1) (IntegerConstant 10 (Integer 4 [])) ()) (= (Var 2 i2) (IntegerConstant 4 (Integer 4 [])) ()) (= (Var 2 i1) (IntegerConstant 3 (Integer 4 [])) ()) (= (Var 2 i2) (IntegerConstant 5 (Integer 4 [])) ()) (Print () [(IntegerBinOp (IntegerUnaryMinus (Var 2 i1) (Integer 4 []) ()) BitXor (IntegerUnaryMinus (Var 2 i2) (Integer 4 []) ()) (Integer 4 []) ())] () ()) (Assert (IntegerCompare (IntegerBinOp (IntegerUnaryMinus (Var 2 i1) (Integer 4 []) ()) BitXor (IntegerUnaryMinus (Var 2 i2) (Integer 4 []) ()) (Integer 4 []) ()) Eq (IntegerConstant 6 (Integer 4 [])) (Logical 4 []) ()) ())] () Source Public Implementation () .false. .false. .false.), main_program: (Program (SymbolTable 88 {}) main_program [] [(SubroutineCall 1 _lpython_main_program () [] ())]), test_issue_928: (Function (SymbolTable 4 {a: (Variable 4 a Local () () Default (Integer 4 []) Source Public Required .false.), b: (Variable 4 b Local () () Default (Integer 4 []) Source Public Required .false.), c: (Variable 4 c Local () () Default (Tuple [(Integer 4 []) (Integer 4 [])]) Source Public Required .false.)}) test_issue_928 [] [] [(= (TupleConstant [(Var 4 a) (Var 4 b)] (Tuple [(Integer 4 []) (Integer 4 [])])) (TupleConstant [(IntegerConstant 2 (Integer 4 [])) (IntegerConstant 1 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (= (Var 4 c) (TupleConstant [(IntegerConstant 2 (Integer 4 [])) (IntegerConstant 1 (Integer 4 []))] (Tuple [(Integer 4 []) (Integer 4 [])])) ()) (Assert (IntegerCompare (Var 4 a) Eq (IntegerConstant 2 (Integer 4 [])) (Logical 4 []) ()) ()) (Assert (IntegerCompare (Var 4 b) Eq (IntegerConstant 1 (Integer 4 [])) (Logical 4 []) ()) ()) (Assert (LogicalBinOp (IntegerCompare (TupleItem (Var 4 c) (IntegerConstant 0 (Integer 4 [])) (Integer 4 []) ()) Eq (Var 4 a) (Logical 4 []) ()) And (IntegerCompare (TupleItem (Var 4 c) (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) ()) Eq (Var 4 b) (Logical 4 []) ()) (Logical 4 []) ()) ())] () Source Public Implementation () .false. .false. .false.), test_multiple_assign_1: (Function (SymbolTable 3 {a: (Variable 3 a Local () () Default (Integer 4 []) Source Public Required .false.), abs: (ExternalSymbol 3 abs 6 abs lpython_builtin [] abs Private), b: (Variable 3 b Local () () Default (Integer 4 []) Source Public Required .false.), c: (Variable 3 c Local () () Default (Integer 4 []) Source Public Required .false.), d: (Variable 3 d Local () () Default (Real 8 []) Source Public Required .false.), e: (Variable 3 e Local () () Default (Real 4 []) Source Public Required .false.), g: (Variable 3 g Local () () Default (Integer 4 []) Source Public Required .false.), i: (Variable 3 i Local () () Default (List (Real 8 [])) Source Public Required .false.), j: (Variable 3 j Local () () Default (List (Real 8 [])) Source Public Required .false.), k: (Variable 3 k Local () () Default (List (Real 8 [])) Source Public Required .false.), x: (Variable 3 x Local () () Default (Real 4 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Real 8 []) Source Public Required .false.)}) test_multiple_assign_1 [] [] [(= (Var 3 g) (IntegerConstant 5 (Integer 4 [])) ()) (= (Var 3 d) (RealBinOp (Cast (Var 3 g) IntegerToReal (Real 8 []) ()) Add (RealConstant 1.000000 (Real 8 [])) (Real 8 []) ()) ()) (= (Var 3 e) (Cast (RealBinOp (Cast (Var 3 g) IntegerToReal (Real 8 []) ()) Add (RealConstant 1.000000 (Real 8 [])) (Real 8 []) ()) RealToReal (Real 4 []) ()) ()) (= (Var 3 a) (IntegerConstant 10 (Integer 4 [])) ()) (= (Var 3 b) (IntegerConstant 10 (Integer 4 [])) ()) (= (Var 3 c) (IntegerConstant 10 (Integer 4 [])) ()) (Assert (IntegerCompare (Var 3 a) Eq (Var 3 b) (Logical 4 []) ()) ()) (Assert (IntegerCompare (Var 3 b) Eq (Var 3 c) (Logical 4 []) ()) ()) (Assert (IntegerCompare (Var 3 a) Eq (IntegerConstant 10 (Integer 4 [])) (Logical 4 []) ()) ()) (= (Var 3 x) (Cast (RealConstant 23.000000 (Real 8 [])) RealToReal (Real 4 []) (RealConstant 23.000000 (Real 4 []))) ()) (= (Var 3 y) (RealConstant 23.000000 (Real 8 [])) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (Cast (Var 3 x) RealToReal (Real 8 []) ()) Sub (RealConstant 23.000000 (Real 8 [])) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000001 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (Var 3 y) Sub (RealConstant 23.000000 (Real 8 [])) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (Cast (Var 3 e) RealToReal (Real 8 []) ()) Sub (RealConstant 6.000000 (Real 8 [])) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000001 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (Var 3 d) Sub (RealConstant 6.000000 (Real 8 [])) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ()) (= (Var 3 k) (ListConstant [] (List (Real 8 []))) ()) (= (Var 3 g) (IntegerConstant 0 (Integer 4 [])) ()) (DoLoop ((Var 3 g) (IntegerConstant 0 (Integer 4 [])) (IntegerBinOp (IntegerConstant 10 (Integer 4 [])) Sub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant 9 (Integer 4 []))) (IntegerConstant 1 (Integer 4 []))) [(ListAppend (Var 3 k) (RealBinOp (RealBinOp (Cast (Var 3 g) IntegerToReal (Real 8 []) ()) Mul (RealConstant 2.000000 (Real 8 [])) (Real 8 []) ()) Add (RealConstant 5.000000 (Real 8 [])) (Real 8 []) ()))]) (= (Var 3 i) (Var 3 k) ()) (= (Var 3 j) (Var 3 k) ()) (DoLoop ((Var 3 g) (IntegerConstant 0 (Integer 4 [])) (IntegerBinOp (IntegerConstant 10 (Integer 4 [])) Sub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant 9 (Integer 4 []))) (IntegerConstant 1 (Integer 4 []))) [(Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (ListItem (Var 3 i) (Var 3 g) (Real 8 []) ()) Sub (ListItem (Var 3 j) (Var 3 g) (Real 8 []) ()) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (ListItem (Var 3 i) (Var 3 g) (Real 8 []) ()) Sub (ListItem (Var 3 k) (Var 3 g) (Real 8 []) ()) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ()) (Assert (RealCompare (FunctionCall 1 abs@__lpython_overloaded_0__abs 3 abs [((RealBinOp (RealBinOp (RealBinOp (Cast (Var 3 g) IntegerToReal (Real 8 []) ()) Mul (RealConstant 2.000000 (Real 8 [])) (Real 8 []) ()) Add (RealConstant 5.000000 (Real 8 [])) (Real 8 []) ()) Sub (ListItem (Var 3 k) (Var 3 g) (Real 8 []) ()) (Real 8 []) ()))] (Real 8 []) () ()) Lt (RealConstant 0.000000 (Real 8 [])) (Logical 4 []) ()) ())])] () Source Public Implementation () .false. .false. .false.)}) [])

tests/reference/asr-modules_02-ec92e6f.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-modules_02-ec92e6f.stdout",
9-
"stdout_hash": "98ff930596d6a73239b4495a61a8712724e55d902fdb454d030a4286",
9+
"stdout_hash": "d8ca7b38979a150cf81926ae7569ccaefb8f8acb8a282b3d2f4886a3",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

0 commit comments

Comments
 (0)