Since LFortran has not yet implemented the implicit save mis-feature of Fortran, it gives the results an uninitiated Fortran programmer would expect for the slightly modified program
program fibonacci
    use, intrinsic :: iso_fortran_env, only : i8=>int64
    implicit none
    integer :: n=5
    integer(i8) :: f1, f2
    print *, fib(n), fib(n), fib(n)
    print *, fib(n)
    contains
    function fib(n) result(f) ! iterative
        integer,intent(in) :: n
        integer(i8) :: f
        integer(i8) :: tmp=0, f_1=1
        integer :: i=0
        if (n <= 0) then
            write(*,*) 'n must be a positive integer'
            stop 1
        end if
        f=f_1
        do i = 2, n
            tmp=f
            f = f + f_1
            f_1 = tmp
        end do
    end function fib
  end program fibonacci
Ouput:
8 8 8
8
Every compiler has a strict-standard mode, and in that mode LFortran is obliged to give the results produced with implicit save. Maybe the default mode should refuse to compile the program unless the save attribute is added explicitly.