Welcome to Week 9! This week was focused on resolving the LLVM generation stage for the Fortran Package Manager (FPM) via LFortran. Many issues previously blocked in the ASR-to-LLVM phase are now either fixed or isolated via MREs. Half the modules now compile fully to LLVM IR.
The core bottlenecks addressed include operator overloading resolution and class polymorphism handling. We now estimate around 8–10 remaining issues to complete the full LLVM IR generation for FPM!
Work done this week:
-
ASR to LLVM Fixes:
- 50% of FPM modules now successfully compile to LLVM code.
- Key issues fixed around class methods and operator resolution.
-
Example workarounds:
-
Key MREs created:
- Issue #8044: Allow type variable passed to function which expects pointer to type variable and is intent(in)
- Issue #8045: Handle StructType array passed to function which expects ClassType Array
- Issue #8061: Handle Passing pointer structInstanceMember to recursive function which not expect pointer
- Issue #8046: Handle parent Type assignments where we directly assign all members of parent. This is a new feature that we need to handle to assign all members of subclass with one expression. I will be fixing this next week.
-
Sample Fixes / Pull Requests:
- PR #8053: Handles pointer to data array in convert polymorphic arg where actual arg is not classType
- PR #8058: Allow passing value to function which expects pointer when argument is intent(in). Previously LFortran was not allowing it but it should be allowed.
- PR #8059: Check if Struct member is fixed size array while creating temporary. Basically, here if struct array member's size is not fixed then we can't determine it at compile time. So while creating temporary we need to keep it as allocatable and allocate length at runtime.
Around 18 hours were spent this week understanding the ASR-to-LLVM bridge and debugging crashes. With these improvements, the LLVM generation stage is now highly promising.
Thanks again to Ondřej Čertík and Pranav Goswami for guiding tricky LLVM fixes and reviewing MRs.
Plan for next week:
- Target remaining 8–10 LLVM MREs and enable full FPM IR generation.
- Fixing all MREs that are remaining.
- Set FPM on CI Pipeline to test.