Error in Constructing array with Implied do loop

Recently i was playing with fortran array, in lfortran online IDE.
i try to run this code.

program arrays_01
 implicit none
 real , dimension (6) :: x
 integer :: i , j
 x = [( i *2 , i = 1 , 6)]
 print * , x

end program arrays_01

but i got this error :

LCompilers::LCompilersException: visit_ImpliedDoLoop() not implemented
ERROR: The code could not be compiled. Either there is a compile-time error or there is an issue at our end.

Is this is a bug or something wrong with my code.

Hi, there is no bug in your code. As said in the error message, it seems the functionality is not yet implemented in the compiler.

You can cross-check with Online Fortran Compiler - online editor that uses gfortran. It will return the correct output.

1 Like

Issues with the LFortran compiler are listed at GitHub and can be searched. The OP’s issue is Implied do loops.

1 Like

Thanks @hkvzjal now it’s working

oh got it, Thankyou