Skip to content
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

Fix array symbol duplication in interactive mode #4072

Merged
merged 1 commit into from
May 25, 2024

Conversation

Vipul-Cariappa
Copy link
Contributor

Fixes the following problem:

❯ lf
Interactive Fortran. Experimental prototype, not ready for end users.
LFortran version: 0.0.0
  * Use Ctrl-D to exit
  * Use Enter to submit
  * Use Alt-Enter or Ctrl-N to make a new line
    - Editing (Keys: Left, Right, Home, End, Backspace, Delete)
    - History (Keys: Up, Down)
>>> integer :: i(10)                                                                                                1,17  ]
>>> print *, i                                                                                                      1,11  ]
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  Binary file "/home/vipul/Workspace/others/lfortran/src/bin/lfortran", in _start()
  Binary file "/lib64/libc.so.6", in __libc_start_main_alias_2()
  Binary file "/lib64/libc.so.6", in __libc_start_call_main()
  File "/home/vipul/Workspace/others/lfortran/src/bin/lfortran.cpp", line 2462, in main()
    return main_app(argc, argv);
  File "/home/vipul/Workspace/others/lfortran/src/bin/lfortran.cpp", line 2256, in main_app(int, char**)
    return prompt(arg_v, compiler_options);
  File "/home/vipul/Workspace/others/lfortran/src/bin/lfortran.cpp", line 298, in prompt()
    res = e.evaluate(input, verbose, lm, lpm, diagnostics);
  File "/home/vipul/Workspace/others/lfortran/src/lfortran/fortran_evaluator.cpp", line 126, in LCompilers::FortranEvaluator::evaluate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, LCompilers::LocationManager&, LCompilers::PassManager&, LCompilers::diag::Diagnostics&)
    e->add_module(std::move(m));
  File "/home/vipul/Workspace/others/lfortran/src/libasr/codegen/evaluator.cpp", line 244, in LCompilers::LLVMEvaluator::add_module(std::unique_ptr<LCompilers::LLVMModule, std::default_delete<LCompilers::LLVMModule> >)
    add_module(std::move(m->m_m));
LCompilersException: addModule() returned an error: Duplicate definition of symbol 'i'

@Vipul-Cariappa
Copy link
Contributor Author

cc @Shaikh-Ubaid

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine, thanks for adding a test.

@certik certik merged commit ef6767a into lfortran:main May 25, 2024
23 checks passed
@Shaikh-Ubaid
Copy link
Member

>>> print *, i  

We also should be able to support printing i for the following. Using an explicit print should not be necessary.

i

@Vipul-Cariappa
Copy link
Contributor Author

We also should be able to support printing i for the following. Using an explicit print should not be necessary.

Yes, but it is not supported yet. That is printing any of the aggregate datatypes in the REPL without explicit print is not yet supported. I will add it in eventually, with the support to print list, dict, etc.

@Vipul-Cariappa Vipul-Cariappa deleted the arr-dup branch May 25, 2024 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants