Skip to content

LIBASR Sync #2860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ RUN(NAME exit_02b FAIL LABELS cpython llvm llvm_jit c wasm wasm_x86 wasm_x
RUN(NAME exit_02c FAIL LABELS cpython llvm llvm_jit c)

# Test all four backends
# RUN(NAME print_01 LABELS cpython llvm llvm_jit wasm) # renable c, wasm not yet supports sep and end keywords
RUN(NAME print_01 LABELS cpython llvm llvm_jit) # renable c, wasm not yet supports sep and end keywords, wasm does not handle DescriptorString
RUN(NAME print_03 LABELS x86 c wasm wasm_x86 wasm_x64) # simple test case specifically for x86, wasm_x86 and wasm_x64
RUN(NAME print_04 LABELS cpython llvm llvm_jit c)
RUN(NAME print_06 LABELS cpython llvm llvm_jit) # renable c
Expand Down Expand Up @@ -534,14 +534,14 @@ RUN(NAME test_types_02 LABELS cpython llvm llvm_jit c wasm)
# RUN(NAME test_str_05 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_str_06 LABELS cpython llvm llvm_jit c)
RUN(NAME test_string_01 LABELS cpython llvm llvm_jit) # renable c
# RUN(NAME test_list_01 LABELS cpython llvm llvm_jit c)
RUN(NAME test_list_01 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_list_02 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_list_03 LABELS cpython llvm llvm_jit c NOFAST)
# RUN(NAME test_list_04 LABELS cpython llvm llvm_jit c NOFAST)
# RUN(NAME test_list_05 LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME test_list_06 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_list_07 LABELS cpython llvm llvm_jit c NOFAST)
# RUN(NAME test_list_08 LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME test_list_07 LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME test_list_08 LABELS cpython llvm llvm_jit c NOFAST)
# RUN(NAME test_list_09 LABELS cpython llvm llvm_jit c NOFAST)
# RUN(NAME test_list_10 LABELS cpython llvm llvm_jit c NOFAST)
# RUN(NAME test_list_11 LABELS cpython llvm llvm_jit c)
Expand All @@ -554,7 +554,7 @@ RUN(NAME test_list_06 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_list_repeat2 LABELS cpython llvm llvm_jit c NOFAST)
# RUN(NAME test_list_reverse LABELS cpython llvm llvm_jit) # post sync
# RUN(NAME test_list_pop LABELS cpython llvm llvm_jit NOFAST) # TODO: Remove NOFAST from here.
# RUN(NAME test_list_pop2 LABELS cpython llvm llvm_jit NOFAST) # TODO: Remove NOFAST from here.
RUN(NAME test_list_pop2 LABELS cpython llvm llvm_jit NOFAST) # TODO: Remove NOFAST from here.
RUN(NAME test_list_pop3 LABELS cpython llvm llvm_jit)
# RUN(NAME test_list_compare LABELS cpython llvm llvm_jit) # post sync
RUN(NAME test_list_compare2 LABELS cpython llvm llvm_jit)
Expand All @@ -570,15 +570,15 @@ RUN(NAME test_const_access LABELS cpython llvm llvm_jit) # post sync
# RUN(NAME test_tuple_nested LABELS cpython llvm llvm_jit) # post sync
# RUN(NAME test_const_dict LABELS cpython llvm llvm_jit) # post sync
# RUN(NAME test_params LABELS cpython llvm llvm_jit NOFAST)
# RUN(NAME test_dict_01 LABELS cpython llvm llvm_jit c) # post sync
RUN(NAME test_dict_01 LABELS cpython llvm llvm_jit c) # post sync
RUN(NAME test_dict_02 LABELS cpython llvm llvm_jit c NOFAST)
# RUN(NAME test_dict_03 LABELS cpython llvm llvm_jit NOFAST)
# RUN(NAME test_dict_04 LABELS cpython llvm llvm_jit NOFAST)
RUN(NAME test_dict_05 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_dict_06 LABELS cpython llvm llvm_jit c)
RUN(NAME test_dict_06 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_dict_07 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_dict_08 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_dict_09 LABELS cpython llvm llvm_jit c)
RUN(NAME test_dict_08 LABELS cpython llvm llvm_jit c)
RUN(NAME test_dict_09 LABELS cpython llvm llvm_jit c)
# RUN(NAME test_dict_10 LABELS cpython llvm llvm_jit) # renable c # post sync
# RUN(NAME test_dict_11 LABELS cpython llvm llvm_jit c) # post sync
# RUN(NAME test_dict_12 LABELS cpython llvm llvm_jit) # renable c # post sync
Expand Down Expand Up @@ -632,7 +632,7 @@ RUN(NAME test_random_02 LABELS cpython llvm llvm_jit NOFAST)
# RUN(NAME test_builtin LABELS cpython llvm llvm_jit) # renable c # post sync
RUN(NAME test_builtin_abs LABELS cpython llvm llvm_jit c)
# RUN(NAME test_builtin_bool LABELS cpython llvm llvm_jit c)
# RUN(NAME test_builtin_pow LABELS cpython llvm llvm_jit c EXTRA_ARGS --no-warnings)
RUN(NAME test_builtin_pow LABELS cpython llvm llvm_jit c EXTRA_ARGS --no-warnings)
# RUN(NAME test_builtin_int LABELS cpython llvm llvm_jit c)
# RUN(NAME test_builtin_len LABELS cpython llvm llvm_jit c)
# RUN(NAME test_builtin_str LABELS cpython llvm llvm_jit c)
Expand Down Expand Up @@ -670,7 +670,7 @@ RUN(NAME test_c_interop_03 LABELS cpython llvm c
# RUN(NAME bindpy_05 LABELS llvm_py c_py EXTRA_ARGS --enable-cpython COPY_TO_BIN bindpy_05_module.py REQ_PY_VER 3.10)
# RUN(NAME bindpy_06 LABELS cpython llvm_py EXTRA_ARGS --enable-cpython NOFAST COPY_TO_BIN bindpy_06_module.py REQ_PY_VER 3.10)
# RUN(NAME test_generics_01 LABELS cpython llvm llvm_jit NOFAST) # renable c # post sync
# RUN(NAME test_cmath LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME test_cmath LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME test_complex_01 LABELS cpython llvm llvm_jit c wasm wasm_x64)
RUN(NAME test_complex_02 LABELS cpython llvm llvm_jit c)
RUN(NAME test_ConstantEllipsis LABLES cpython llvm llvm_jit c)
Expand Down
11 changes: 6 additions & 5 deletions integration_tests/test_cmath.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from cmath import (exp, log, sqrt, acos, asin, atan, cos, sin, tan,
acosh, asinh, atanh, cosh, sinh, tanh,
phase, polar, rect)
from lpython import c64, c32, f64
from cmath import (acos, acosh, asin, asinh, atan, atanh, cos, cosh, exp, log,
phase, polar, rect, sin, sinh, sqrt, tan, tanh)

from lpython import c32, c64, f64


def test_power_logarithmic():
x: c64
Expand Down Expand Up @@ -73,4 +74,4 @@ def test_polar():
test_power_logarithmic()
test_trigonometric()
test_hyperbolic()
test_polar()
test_polar()
2 changes: 1 addition & 1 deletion libasr
Submodule libasr updated 1225 files
4 changes: 2 additions & 2 deletions src/bin/lpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,7 @@ int main(int argc, char *argv[])
lpython_pass_manager.use_default_passes();
compiler_options.po.disable_main = true;
compiler_options.emit_debug_line_column = false;
compiler_options.generate_object_code = false;
compiler_options.separate_compilation = false;
return interactive_python_repl(lpython_pass_manager, compiler_options, arg_v);
#else
std::cerr << "Interactive prompt requires the LLVM backend to be enabled. Recompile with `WITH_LLVM=yes`." << std::endl;
Expand Down Expand Up @@ -2216,7 +2216,7 @@ int main(int argc, char *argv[])
}
compiler_options.emit_debug_info = false;
compiler_options.emit_debug_line_column = false;
compiler_options.generate_object_code = false;
compiler_options.separate_compilation = false;
return compile_python_using_llvm(arg_file, "", runtime_library_dir,
lpython_pass_manager, compiler_options, time_report, false, true);
#else
Expand Down
2 changes: 1 addition & 1 deletion src/lpython/python_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace LCompilers::LPython {
e.compiler_options.interactive = true;
e.compiler_options.po.disable_main = true;
e.compiler_options.emit_debug_line_column = false;
e.compiler_options.generate_object_code = false;
e.compiler_options.separate_compilation = false;
}
virtual ~custom_interpreter() = default;

Expand Down
30 changes: 17 additions & 13 deletions src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,8 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
variable_dependencies_vec.size(), ASR::intentType::Local,
nullptr, nullptr, ASR::storage_typeType::Default,
type, nullptr, ASR::abiType::Source, ASR::accessType::Public,
ASR::presenceType::Required, false, false, false, nullptr, false);
ASR::presenceType::Required, false, false, false, nullptr,
false,false);
ASR::symbol_t* variable_sym = ASR::down_cast<ASR::symbol_t>(variable_asr);
current_scope->add_symbol(dummy_ret_name, variable_sym);
ASR::expr_t* variable_var = ASRUtils::EXPR(ASR::make_Var_t(al, expr->base.loc, variable_sym));
Expand Down Expand Up @@ -2759,7 +2760,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
variable_dependencies_vec.size(),
s_intent, nullptr, nullptr, storage_type, type,
nullptr, current_procedure_abi_type, s_access,
s_presence, value_attr, false, false, nullptr, false);
s_presence, value_attr, false, false, nullptr, false, false);
ASR::symbol_t* v_sym = ASR::down_cast<ASR::symbol_t>(v);
current_scope->add_or_overwrite_symbol(var_name, v_sym);
}
Expand Down Expand Up @@ -2916,7 +2917,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
variable_dependencies_vec.size(), ASRUtils::intent_unspecified,
nullptr, nullptr, ASR::storage_typeType::Default, fn_type->m_arg_types[i],
nullptr, ASR::abiType::Source, ASR::Public, ASR::presenceType::Required,
false, false, false, nullptr, false));
false, false, false, nullptr, false, false));
current_scope->add_symbol(arg_name, v);
LCOMPILERS_ASSERT(v != nullptr)
args.push_back(al, ASRUtils::EXPR(ASR::make_Var_t(al, x.m_args.m_args[i].loc, v)));
Expand Down Expand Up @@ -3515,7 +3516,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
s2c(al, var_name), variable_dependencies_vec.p,
variable_dependencies_vec.size(), s_intent, init_expr,
value, storage_type, type, nullptr, current_procedure_abi_type,
s_access, s_presence, value_attr, false, false, nullptr, false);
s_access, s_presence, value_attr, false, false, nullptr, false, false);
current_scope->add_symbol(var_name, ASR::down_cast<ASR::symbol_t>(v));
}

Expand Down Expand Up @@ -3545,7 +3546,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
variable_dependencies_vec.size(),
s_intent, init_expr, value, storage_type, type, nullptr,
current_procedure_abi_type, s_access, s_presence,
value_attr, false, false, nullptr, false);
value_attr, false, false, nullptr, false, false);
current_scope->add_symbol(var_name, ASR::down_cast<ASR::symbol_t>(v));
}

Expand Down Expand Up @@ -4418,6 +4419,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
/* a_name */ s2c(al, module_name),
nullptr,
0,
nullptr,
false, false);
module_sym = ASR::down_cast<ASR::Module_t>(ASR::down_cast<ASR::symbol_t>(tmp1));
parent_scope->add_symbol(module_name, ASR::down_cast<ASR::symbol_t>(tmp1));
Expand Down Expand Up @@ -4467,7 +4469,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
variable_dependencies_vec.size(), ASRUtils::intent_unspecified,
nullptr, nullptr, ASR::storage_typeType::Default, func->m_arg_types[i],
nullptr, ASR::abiType::Source, ASR::Public, ASR::presenceType::Required,
false, false, false, nullptr, false));
false, false, false, nullptr, false, false));
current_scope->add_symbol(arg_name, v);
LCOMPILERS_ASSERT(v != nullptr)
args.push_back(al, ASRUtils::EXPR(ASR::make_Var_t(al, loc,
Expand All @@ -4486,7 +4488,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
variable_dependencies_vec.size(), ASRUtils::intent_return_var,
nullptr, nullptr, ASR::storage_typeType::Default, func->m_return_var_type,
nullptr, ASR::abiType::Source, ASR::Public, ASR::presenceType::Required,
false, false, false, nullptr, false);
false, false, false, nullptr, false, false);
current_scope->add_symbol(return_var_name, ASR::down_cast<ASR::symbol_t>(return_var));
to_return = ASRUtils::EXPR(ASR::make_Var_t(al, loc,
ASR::down_cast<ASR::symbol_t>(return_var)));
Expand Down Expand Up @@ -4684,6 +4686,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
alloc_arg.n_dims = 0;
alloc_arg.m_type = nullptr;
alloc_arg.m_len_expr = nullptr;
alloc_arg.m_sym_subclass = nullptr;
alloc_args.push_back(al, alloc_arg);
init_expr = ASRUtils::EXPR(ASR::make_Allocate_t(al, loc, alloc_args.p, 1, nullptr, nullptr, nullptr));

Expand Down Expand Up @@ -4726,7 +4729,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
variable_dependencies_vec.size(),
s_intent, init_expr, value, storage_type, arg_type,
nullptr, current_procedure_abi_type, s_access, s_presence,
value_attr, false, false, nullptr, false);
value_attr, false, false, nullptr, false, false);
v = ASR::down_cast<ASR::symbol_t>(_tmp);

}
Expand Down Expand Up @@ -4770,7 +4773,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
current_scope, s2c(al, return_var_name), variable_dependencies_vec.p,
variable_dependencies_vec.size(), ASRUtils::intent_return_var,
nullptr, nullptr, storage_type, type, nullptr, current_procedure_abi_type, ASR::Public,
ASR::presenceType::Required, false, false, false, nullptr, false);
ASR::presenceType::Required, false, false, false, nullptr, false, false);
LCOMPILERS_ASSERT(current_scope->get_scope().find(return_var_name) == current_scope->get_scope().end())
current_scope->add_symbol(return_var_name,
ASR::down_cast<ASR::symbol_t>(return_var));
Expand Down Expand Up @@ -5108,7 +5111,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
ASR::asr_t *v = ASR::make_Variable_t(al, x.base.base.loc, current_scope,
s2c(al, tvar_name), variable_dependencies_vec.p, variable_dependencies_vec.size(),
s_intent, init_expr, value, storage_type, type, nullptr, current_procedure_abi_type,
s_access, s_presence, value_attr, false, false, nullptr, false);
s_access, s_presence, value_attr, false, false, nullptr, false, false);
current_scope->add_symbol(tvar_name, ASR::down_cast<ASR::symbol_t>(v));

tmp = nullptr;
Expand Down Expand Up @@ -5868,7 +5871,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
variable_dependencies_vec.p, variable_dependencies_vec.size(),
ASR::intentType::Local, nullptr, nullptr, storage_type,
int_type, nullptr, ASR::abiType::Source, ASR::accessType::Public,
ASR::presenceType::Required, false, false, false, nullptr, false
ASR::presenceType::Required, false, false, false, nullptr, false, false
);
current_scope->add_symbol(explicit_iter_name,
ASR::down_cast<ASR::symbol_t>(explicit_iter_variable));
Expand Down Expand Up @@ -6075,7 +6078,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
s2c(al, tmp_assign_name), variable_dependencies_vec.p, variable_dependencies_vec.size(),
ASR::intentType::Local, nullptr, nullptr, ASR::storage_typeType::Default,
loop_src_var_ttype, nullptr, ASR::abiType::Source, ASR::accessType::Public,
ASR::presenceType::Required, false, false, false, nullptr, false
ASR::presenceType::Required, false, false, false, nullptr, false, false
);
ASR::symbol_t *tmp_assign_variable_sym = ASR::down_cast<ASR::symbol_t>(tmp_assign_variable);
current_scope->add_symbol(tmp_assign_name, tmp_assign_variable_sym);
Expand Down Expand Up @@ -6113,7 +6116,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
s2c(al, tmp_assign_name), variable_dependencies_vec.p, variable_dependencies_vec.size(),
ASR::intentType::Local, nullptr, nullptr, ASR::storage_typeType::Default,
loop_src_var_ttype, nullptr, ASR::abiType::Source, ASR::accessType::Public,
ASR::presenceType::Required, false, false, false, nullptr, false
ASR::presenceType::Required, false, false, false, nullptr, false, false
);
ASR::symbol_t *tmp_assign_variable_sym = ASR::down_cast<ASR::symbol_t>(tmp_assign_variable);
current_scope->add_symbol(tmp_assign_name, tmp_assign_variable_sym);
Expand Down Expand Up @@ -8791,6 +8794,7 @@ we will have to use something else.
new_arg.m_dims = dims.p;
new_arg.n_dims = dims.size();
new_arg.m_a = assign_asr_target;
new_arg.m_sym_subclass = nullptr;
alloc_args_vec.push_back(al, new_arg);
tmp = ASR::make_Allocate_t(al, loc,
alloc_args_vec.p, alloc_args_vec.size(),
Expand Down
Loading
Loading