lfortran / lfortran

Official main repository for LFortran
https://lfortran.org/
Other
961 stars 155 forks source link

How to represent `logical :: x(10,9) = .false.` in ASR? #4898

Open Pranavchiku opened 1 month ago

Pranavchiku commented 1 month ago
program main
logical :: k(5) = .false.
logical :: screen(0:63,0:31) = .false.
print *, "k: ", k
end program

Fails with latest main

jinangshah21 commented 1 month ago

I had broadcast .false. w.r.t dimensions given in screen in ast_common_visitor.h But in pass_utils.h it is giving LcompilerAssert :

(Output : n-dimension of rhs and number of elements in 1st dimension after broadcasting)
1 5
2 64 
LCOMPILERS_ASSERT failed: /mnt/c/lfortran/src/libasr/../libasr/pass/pass_utils.h
function replace_ArrayConstructor(), line number 955 at
ASRUtils::extract_n_dims_from_ttype(result_var_type) == 1
ERROR MESSAGE:
Initialisation using ArrayConstructor is supported only for single dimensional arrays, found: 2