LFortran
Trying to summarizing my work at LFortan. arranged from most recent to least recent by date.
Tokenizing complex*8
Date: Feb 2, 2023.
While trying to compile LAPACK source files with LFortran compiler, I can accross below given code which halts compiler from execution.
Digging deep into it, I found that it there are no provision to tokenize keyword "complex*Y" where Y belongs to {4,8,16} and because of that it stuck into infinite loop and resulted in a halt. Then I checked if "real*8" is tokenized with LFortran or not and greatly it did, I just copied over implementation from it for complex and bam! It worked. That's all about a part of my work at LFortran. Lfortran/issue/1235 and fix at Lfortran/pull/1244.
Fixing ASR:Verify Fail
Date: Jan 18, 2023.
Ahh, this error is the most encountered by me in last few weeks, while I try to compile minpack with latest main of LFortran. At Lfortran(LF) we use various passes, for code optimisation and refactoring of some portion of code like a function which returns an array will be converted to a subroutine with the destination array as the last argument. This helps in avoiding deep copies and the destination memory directly gets filled inside the subroutine. So the code is more efficient. But this also leads to some problems, like the ASR(Analysis Symbol Resolution) verify, which is used to resolve the symbols in the code, fails to resolve the symbols in the code.
There can me many reasons for this error as it is highly generic, I have solved 2 - 3 of them each having a different approach. So the problem for this is because of `array_op` pass which converted Function to subroutine and ASR verify failed. On investigating I found out that it is failing because, the Function was passed as a parameter in another function call which consists and interface for it and hence both were not matching. So I had to add a check if the function is passed as a parameter in another function call, then it should not be converted to a subroutine and bam! it worked :) You can find more about it at Lfortran/issue/1194 and fix at Lfortran/pull/1195.