Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty array not really empty? #3850

Open
harperjf opened this issue Apr 11, 2024 · 1 comment · May be fixed by #3937
Open

empty array not really empty? #3850

harperjf opened this issue Apr 11, 2024 · 1 comment · May be fixed by #3937
Labels
bug Something isn't working

Comments

@harperjf
Copy link

This program prints two colons with nothing between them with gfortran, ifort, ifx and g95. So does AOCC flang
after a compile-time warning 'Array declared with zero size', but lfortran prints the 3-line output below the program.
That looks like a run-time bug.

(lf2) john:~/Test$ cat emptytest1.f90
program emptytest1
  implicit none
  real :: empty(0) = [real  ::]
  print "(2A)",':',empty(:),':'
end program emptytest1
(lf2) john:~/Test$ lfortran emptytest1.f90
:

:
(lf2) john:~/Test$ 
@Shaikh-Ubaid
Copy link
Member

I think it is a bug in our ASR pass print_arr.cpp.

% cat examples/expr2.f90     
program emptytest1
    implicit none
    real :: empty(1) = [5]
    print *,':',empty,':'
end program emptytest1
% gfortran examples/expr2.f90
% ./a.out 
 :   5.00000000     :
% lfortran examples/expr2.f90
: 5.00000000e+00 
:

@Shaikh-Ubaid Shaikh-Ubaid added the bug Something isn't working label Apr 11, 2024
gxyd added a commit to gxyd/lfortran that referenced this issue Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants