Week3 - Bug fixes COMMON Blocks

Continuation of COMMON block

Date: June 4, 2023.

Welcome back to the third blog of my GSoC '23 journey. This week I worked majorly to pick and fix bugs related to COMMON blocks.

Picking up the last week work on Issue: 1723 which was about LFortran not being able to identify struct members. On discussion with Ondrej we found that the fix was hidden in `visit_Variable` function of asr_to_llvm.cpp. It got fixed by adding provision to intialize non c_ptr structs while visiting them.

With PR: 1731 we were able to make COMMON blocks work with LLVM backend. On increasing the complexity of tests we found that code was not able to compile for case in which arrays are part of common block and are used in the program. We have Issue: 1734 dedicated to it, digging deep we found that LFortran is unable to access the arrays defined inside module, the use case supported right now is arrays declared and used inside functions/subroutines and the main program itself. Whereas we are trying to access the array defined inside module from main program. We are still working on it and will be fixed soon. A dedicated issue for it is Issue: 1735.

To utilize the time efficiently we decided to scan SciPy and see if we are missing any edge cases, doing so we caught Issue: 1715. It is about, the common block declares an array, the type declared in the function does not mention the dimension, so we need to get the dimension from the common block. This was fixed by PR: 1738.

Later, there were few other issues reported and fixed like Issue: 1728, Issue: 1755, Issue: 1756, and many not registered which are fixed by PR: 1754. All these are mostly the edge cases which were missed during initial implementation.

With PR: 1754 and 24 hours of work this week, I was able to compile COMMON blocks present in SciPy codebase completely to ASR and the cases which exclude array inside COMMON blocks to LLVM aswell. I would like to thank Ondřej Čertík for taking out time and helping me when I was stuck. Looking forward to many more commits.

For the next week, I will try to get Issue: 1734 fixed, apart from this I will try to get implementation of Union of structs, if doable quickly, else we now have sufficient infrastructure to proceed on Block_Data() implementation, so I will start working on it.