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

Interactive shell errors when logical values are used. #4005

Open
Vipul-Cariappa opened this issue May 14, 2024 · 3 comments
Open

Interactive shell errors when logical values are used. #4005

Vipul-Cariappa opened this issue May 14, 2024 · 3 comments

Comments

@Vipul-Cariappa
Copy link
Contributor

Example:

❯ lf
Interactive Fortran. Experimental prototype, not ready for end users.
LFortran version: 0.35.0-180-ga53354837
  * 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)
>>> .true.                                                                                                                             1,7   ]
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  Binary file "/home/vipul/Workspace/bin/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()
  Binary file "/home/vipul/Workspace/bin/lfortran/src/bin/lfortran", in main()
  Binary file "/home/vipul/Workspace/bin/lfortran/src/bin/lfortran", in main_app(int, char**)
  File "lfortran.cpp", line 0, in (anonymous namespace)::prompt(bool, LCompilers::CompilerOptions&) [clone .isra.0]
  Binary file "/home/vipul/Workspace/bin/lfortran/src/bin/lfortran", 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&)
  Binary file "/home/vipul/Workspace/bin/lfortran/src/bin/lfortran", in LCompilers::FortranEvaluator::get_llvm3(LCompilers::ASR::TranslationUnit_t&, LCompilers::PassManager&, LCompilers::diag::Diagnostics&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
  Binary file "/home/vipul/Workspace/bin/lfortran/src/bin/lfortran", in LCompilers::asr_to_llvm(LCompilers::ASR::TranslationUnit_t&, LCompilers::diag::Diagnostics&, llvm::LLVMContext&, Allocator&, LCompilers::PassManager&, LCompilers::CompilerOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
LCompilersException: Return type not supported in interactive mode
@Vipul-Cariappa Vipul-Cariappa changed the title LFortran interactive shell errors when logical values are used. Interactive shell errors when logical values are used. May 14, 2024
@kmr-srbh
Copy link
Contributor

@Vipul-Cariappa thanks for bringing this to notice. This issue occurs for other types like characters and arrays as well.

(base) saurabh-kumar@Awadh:~$ lfortran
Interactive Fortran. Experimental prototype, not ready for end users.
LFortran version: 0.1.0-5-g92d644b2b-dirty
  * 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)
>>> "a"                                                                  1,4   ]
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  Binary file "/home/saurabh-kumar/Projects/System/lfortran/src/bin/lfortran", in _start()
  File "./csu/../csu/libc-start.c", line 360, in __libc_start_main_impl()
  File "./csu/../sysdeps/x86/libc-start.c", line 58, in __libc_start_call_main()
  File "/home/saurabh-kumar/Projects/System/lfortran/src/bin/lfortran.cpp", line 2462, in main()
    return main_app(argc, argv);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/bin/lfortran.cpp", line 2256, in main_app(int, char**)
    return prompt(arg_v, compiler_options);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/bin/lfortran.cpp", line 298, in prompt()
    res = e.evaluate(input, verbose, lm, lpm, diagnostics);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/lfortran/fortran_evaluator.cpp", line 110, 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&)
    pass_manager, diagnostics, lm.files.back().in_filename);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/lfortran/fortran_evaluator.cpp", line 359, in LCompilers::FortranEvaluator::get_llvm3(LCompilers::ASR::TranslationUnit_t&, LCompilers::PassManager&, LCompilers::diag::Diagnostics&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    compiler_options, run_fn, infile);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/libasr/codegen/asr_to_llvm.cpp", line 9831, in LCompilers::asr_to_llvm(LCompilers::ASR::TranslationUnit_t&, LCompilers::diag::Diagnostics&, llvm::LLVMContext&, Allocator&, LCompilers::PassManager&, LCompilers::CompilerOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    pass_manager.apply_passes(al, &asr, co.po, diagnostics);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/libasr/pass/pass_manager.h", line 311, in LCompilers::PassManager::apply_passes(Allocator&, LCompilers::ASR::TranslationUnit_t*, LCompilers::PassOptions&, LCompilers::diag::Diagnostics&)
    apply_passes(al, asr, _passes, pass_options, diagnostics);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/libasr/pass/pass_manager.h", line 167, in LCompilers::PassManager::apply_passes(Allocator&, LCompilers::ASR::TranslationUnit_t*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, LCompilers::PassOptions&, LCompilers::diag::Diagnostics&)
    _passes_db[passes[i]](al, *asr, pass_options);
LCompilersException: Return type not supported in interactive mode
>>> 1                                                                    1,2   ]
1
>>> [1, 2, 3, 4]                                                         1,13  ]
Internal Compiler Error: Unhandled exception
Traceback (most recent call last):
  Binary file "/home/saurabh-kumar/Projects/System/lfortran/src/bin/lfortran", in _start()
  File "./csu/../csu/libc-start.c", line 360, in __libc_start_main_impl()
  File "./csu/../sysdeps/x86/libc-start.c", line 58, in __libc_start_call_main()
  File "/home/saurabh-kumar/Projects/System/lfortran/src/bin/lfortran.cpp", line 2462, in main()
    return main_app(argc, argv);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/bin/lfortran.cpp", line 2256, in main_app(int, char**)
    return prompt(arg_v, compiler_options);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/bin/lfortran.cpp", line 298, in prompt()
    res = e.evaluate(input, verbose, lm, lpm, diagnostics);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/lfortran/fortran_evaluator.cpp", line 110, 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&)
    pass_manager, diagnostics, lm.files.back().in_filename);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/lfortran/fortran_evaluator.cpp", line 359, in LCompilers::FortranEvaluator::get_llvm3(LCompilers::ASR::TranslationUnit_t&, LCompilers::PassManager&, LCompilers::diag::Diagnostics&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    compiler_options, run_fn, infile);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/libasr/codegen/asr_to_llvm.cpp", line 9831, in LCompilers::asr_to_llvm(LCompilers::ASR::TranslationUnit_t&, LCompilers::diag::Diagnostics&, llvm::LLVMContext&, Allocator&, LCompilers::PassManager&, LCompilers::CompilerOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    pass_manager.apply_passes(al, &asr, co.po, diagnostics);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/libasr/pass/pass_manager.h", line 311, in LCompilers::PassManager::apply_passes(Allocator&, LCompilers::ASR::TranslationUnit_t*, LCompilers::PassOptions&, LCompilers::diag::Diagnostics&)
    apply_passes(al, asr, _passes, pass_options, diagnostics);
  File "/home/saurabh-kumar/Projects/System/lfortran/src/libasr/pass/pass_manager.h", line 167, in LCompilers::PassManager::apply_passes(Allocator&, LCompilers::ASR::TranslationUnit_t*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, LCompilers::PassOptions&, LCompilers::diag::Diagnostics&)
    _passes_db[passes[i]](al, *asr, pass_options);
LCompilersException: Return type not supported in interactive mode
>>>   

@Vipul-Cariappa
Copy link
Contributor Author

Yes, I know. I am working on a fix for booleans right now. Others are quite involved. Will have to tackle other datatypes later.

@certik
Copy link
Contributor

certik commented May 14, 2024

Yes, I think we have not implemented booleans as return types yet from LLVM in interactive mode.

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

No branches or pull requests

3 participants