Closed
Description
Bug in ListConcat:
$ cat examples/expr2.py
from lpython import i32
def test_list_concat():
t1: list[i32]
t1 = [2] + [3]
print(t1)
test_list_concat()
$ python examples/expr2.py
[2, 3]
$ lpython examples/expr2.py
[2, 3]
$ lpython examples/expr2.py --backend c
expr2__tmp__generated__.c:43:27: error: expected expression
list_deepcopy_i32( struct list_i32 constname0;
^
1 error generated.
The command 'gcc -o expr2.out expr2__tmp__generated__.c -I /Users/ubaid/Desktop/OpenSource/orig_lpython/src/bin/../libasr/runtime -L"/Users/ubaid/Desktop/OpenSource/orig_lpython/src/bin/../runtime" -Wl,-rpath,"/Users/ubaid/Desktop/OpenSource/orig_lpython/src/bin/../runtime" -llpython_runtime -lm' failed.
Bug in ListSection:
$ cat examples/expr2.py
from lpython import i32
def test_list_section():
x: list[i32]
x = [5, -6, 7, -1, 2, 10, -8, 15]
print(len(x[1:4]))
test_list_section()
$ python examples/expr2.py
3
$ lpython examples/expr2.py
3
$ lpython examples/expr2.py --backend c
expr2__tmp__generated__.c:57:33: error: member reference type 'struct list_i32 *' is a pointer; did you mean to use '->'?
printf("%d\n", * constname01.current_end_point);
~~~~~~~~~~~^
->
expr2__tmp__generated__.c:57:20: error: indirection requires pointer operand ('int32_t' (aka 'int') invalid)
printf("%d\n", * constname01.current_end_point);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
The command 'gcc -o expr2.out expr2__tmp__generated__.c -I /Users/ubaid/Desktop/OpenSource/orig_lpython/src/bin/../libasr/runtime -L"/Users/ubaid/Desktop/OpenSource/orig_lpython/src/bin/../runtime" -Wl,-rpath,"/Users/ubaid/Desktop/OpenSource/orig_lpython/src/bin/../runtime" -llpython_runtime -lm' failed.