-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Let's take an example of the StringSection node. It was introduced in lpython and now it is also used in lfortran. The current StringSection in the LLVM backend is implemented based on 0-based indexing and so works for lpython but fails for lfortran. We need to have these fixes in ASR so that each front end follows the same indexing in every node.
See the following snippet in python:
def f():
s: str = "checking"
r: str = s[1:4]
print(r)
f()Works fine:
% lpython b.py
hec
% python b.py
hec
Fortran
program main
implicit none
character(len=10) :: b
b = "checking"
print *, b(1:4)
end program mainFails:
% lfortran a.f90
hec
% gfortran a.f90 -o a.out && ./a.out
chec
This should also be kept the same for loops etc.
Metadata
Metadata
Assignees
Labels
No labels