You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the above code, the type of zero->base becomes i32[10] instead of i32[2,5]
So, is it the make_ArrayBroadcast_t_util() that is changing the shape of zero from i32[2,5] to i32[10]? Can you look into previous definition of make_ArrayBroadcast_t_util() (before sync) and the new definition (after sync) and see what might have changed its working?
@Shaikh-Ubaid i was working on integration tests for string i have found an issue how should I fix it
$ cat test.py
x: str
x = "ok"
print(x)
x="abcd"
print(x)
$ lpython test.py
ok
ab
I have a pretty good idea of why this is happening. Its using "constant length fortran strings" from the small examples i've seen; like below
program string
implicit nonecharacter(len=4) :: first_name
first_name ='John'print*, first_name
first_name ='Smith'print*, first_name
end program string
any reason for using arraybroadcast instead of just arrayconstructor?
I don't remember. It is possible that some of the integration tests requires it. You can try commenting it out and/or using array constructor in its place and see if any integration tests fail. The failed integration tests should indicate where/how the arraybroadcast helps.
i was working on integration tests for string i have found an issue how should I fix it
Is the strings issue related to this current issue on arrays? If not we should discuss it on some other thread. The example you shared is
x: str
x = "ok"
print(x)
x="abcd"
print(x)
I can think of two ways of tackling this:
we add a semantic error when someone tries to assign a string of length greater than what we can store in the variable
we keep the current behaviour where we simply copy that many elements of the string that we can store in our variable
It seems we already have 2 working. I don't know if we want 1 here. I would say this does not look like a priority issue. There might be several other issues that could be of higher priority. You can checkout something on lfortran. That is more actively developed and should have things of higher priority than the strings issue that you hit.
For something on lpython, you can try to get back the integration tests working that got disabled during libasr sync.
Activity
swamishiju commentedon Mar 31, 2025
I can take this up tmrw if its still open by then
swamishiju commentedon Apr 1, 2025
I did find a fix but i haven't wrapped my head around why it works yet I'll put up a PR tho
edit: false alarm still doesn't work
swamishiju commentedon Apr 1, 2025
@Shaikh-Ubaid I have identified the code causing the issue but i don't know to fix it, I would appreciate if you could help
lpython/src/lpython/semantics/python_ast_to_asr.cpp
Lines 8652 to 8653 in 1e0d300
In the above code, the type of
zero->basebecomesi32[10]instead ofi32[2,5]swamishiju commentedon Apr 2, 2025
I think we need a deeper look into the handling of arrays, I think print is also broken
pre-sync
ubaidsk commentedon Apr 2, 2025
So, is it the
make_ArrayBroadcast_t_util()that is changing the shape of zero fromi32[2,5]toi32[10]? Can you look into previous definition ofmake_ArrayBroadcast_t_util()(before sync) and the new definition (after sync) and see what might have changed its working?swamishiju commentedon Apr 2, 2025
The type of
zero->basebeforemake_ArrayBroadcast_t_util()isi32after it becomesi32[10]but type ofasr_assign_targetisi32[2, 5]We prolly need to see how
is handled in LF (excuse my syntax if its wrong im not familiar with fortran)
swamishiju commentedon Apr 8, 2025
@Shaikh-Ubaid any reason for using arraybroadcast instead of just arrayconstructor?
swamishiju commentedon Apr 9, 2025
@Shaikh-Ubaid i was working on integration tests for string i have found an issue how should I fix it
I have a pretty good idea of why this is happening. Its using "constant length fortran strings" from the small examples i've seen; like below
swamishiju commentedon Apr 9, 2025
If its smtg in asr->llvm it would need separate libasr right if im not wrong
ubaidsk commentedon Apr 9, 2025
I don't remember. It is possible that some of the integration tests requires it. You can try commenting it out and/or using array constructor in its place and see if any integration tests fail. The failed integration tests should indicate where/how the arraybroadcast helps.
Is the strings issue related to this current issue on arrays? If not we should discuss it on some other thread. The example you shared is
I can think of two ways of tackling this:
It seems we already have 2 working. I don't know if we want 1 here. I would say this does not look like a priority issue. There might be several other issues that could be of higher priority. You can checkout something on lfortran. That is more actively developed and should have things of higher priority than the strings issue that you hit.
For something on lpython, you can try to get back the integration tests working that got disabled during libasr sync.
swamishiju commentedon Apr 9, 2025
Yes thats best discussed on a different thread, I have a fix for the array integration tests #2844
The string issue i mentioned causes some integration tests to fail, another one was returning lists i'll work on those prolly tmrw
Fix for #2841 (#2844)