Closed kmr-srbh closed 3 months ago
Thanks for looking into this. I think this is not a bug, but a feature. When you do --show-asr
you can see the original ASR that was constructed. This ASR is then passed through several ASR->ASR passes. The backends then receive this transformed ASR.
Therefore the ASR that you see from the output of --show-asr
and the ASR that the backends see are different.
To check the ASR that the backends see, you can do --dump-all-passes
and you will get some files generated that contain the ASR output after each pass. You can simply check the ASR output after the last pass as that is the ASR that will be seen by the backends.
PS: You can also combine --visualize
with --dump-all-passes
(or --show-asr
) if you want to see ASR visualization.
The ASR being constructed after the passes in the example shared here https://github.com/lcompilers/lpython/issues/2621#issue-2203815735 is definitely incorrect. I think we have an issue noted for it here https://github.com/lcompilers/lpython/issues/2613.
I am closing this issue for now.
I encountered this bug while working out the fix for #2613 . This bug caused me to wander A LOT trying to find the actual cause of the issue. It was only after executing
std::cout << LCompilers::pickle(asr, true, false, false) << std::endl;
inasr_to_llvm.cpp
that I could see the actual ASR which was being constructed, matching the output I was receiving.Minimum Reproducible Example
Note: The following example will not work after #2620 is merged.
ASR output for
--show-asr
Actual ASR after transformation