Harshita Kalani

Week 2 of GSoC 2024: Intrinsic Functions and Fortran Backend Progress

Hey, welcome to my blog for week 2 of GSoC 2024! This week, I started working on registering the intrinsic functions (array, elemental, and inquiry type) in the Fortran backend. I resolved issues that arose and added tests for them. Almost all the intrinsics are now registered in the Fortran backend and generate corresponding Fortran code with the --show-fortran flag.
Next, I cleaned up the code for array casting of different types and added a logical casting flag.
I then refactored the kind function from an elemental intrinsic to a type inquiry intrinsic, where it belongs, and added support for compile-time reduction of elemental and inquiry functions for extracting the kind. Additionally, I handled array type return types for array inputs in elemental functions.
I'm currently working on implementing the real intrinsic. Several issues have come up, such as those related to implied do loops and array slicing. I've created issues for these and will address them next week.
While debugging, I found that the implementation logic for the unpack intrinsic was incorrect, leading to wrong outputs. I submitted a PR to fix this, and it has been merged.
I then implemented another intrinsic named dgamma and prepared a list of all the intrinsics that are yet to be implemented. You can find them in #4017.
I also worked on removing old code from the previous runtime library, which is one of the deliverables of my GSoC journey.
I've completed the implementation of the achar intrinsic; however, one test case is failing due to handling a null pointer. I will address this next week. I also looked into the reshape intrinsic, but it needs more time.
For the upcoming week, I plan to work on the following tasks:

  • Complete the implementation of the real intrinsic
  • Fix the failing test case for the achar intrinsic or find a workaround
  • Work on the reshape intrinsic
  • Implement the remaining intrinsics according to the tracker
Progress tracker: #4017.
Overall, I found this week's work interesting and am grateful to Ondřej Čertík and the rest of the mentors at LFortran for their constant reviews and suggestions. I look forward to next week and am eager to complete the planned tasks.

Here's a link to related blogs:
GSoC: Week 1
GSoC: Week 3
GSoC: Week 4
GSoC: Week 5