Skip to content

Fixing adjustl

Ubaid Shaikh requested to merge shaikhubaid769/lfortran:fixing_adjustl into master

an attempt towards fixing #683 (closed) .

To work perfectly, it needs len() to be fixed #677 (closed)

Example code:

program test_adjustl
    character(len = 20) :: str = adjustl("    gfortran")
    print *, "|"//str//"|"
end program test_adjustl

gfortran output:

ubaid@ubaid-Lenovo-ideapad-330-15ARR:~/Desktop/My-Projects/GSoC/lfortran$ gfortran Testing/Temporary/main.f90 
ubaid@ubaid-Lenovo-ideapad-330-15ARR:~/Desktop/My-Projects/GSoC/lfortran$ ./a.out 
 |gfortran            |

lfortran output:

ubaid@ubaid-Lenovo-ideapad-330-15ARR:~/Desktop/My-Projects/GSoC/lfortran$ ./src/bin/lfortran Testing/Temporary/main.f90 
ubaid@ubaid-Lenovo-ideapad-330-15ARR:~/Desktop/My-Projects/GSoC/lfortran$ ./a.out 
|gfortran    |

The reason it does not work perfectly is that the len function returns a length of 12 instead of the original length of 20.

Edited by Ubaid Shaikh

Merge request reports

Loading