lfortran / lfortran/lfortran

Declaring and initializing arrays doesn't work

Open
#271 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.2k
Forks
271
Avg merge
1d 2h
Merged PRs (30d)
173

Description

Original issue: https://gitlab.com/lfortran/lfortran/-/issues/205

Reported by @ milancurcic (thanks!):

$ cat test_array.f90 
program array
  real :: a(5)
  a = 1
  print *, a
end program array
$ ./lfortran --static test_array.f90 
$ ./a.out 
0.000000

This should give an error that it is not supported, or it should work. It should never compile without an error and then fail at runtime.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example in test_array.f90 with ./lfortran --static test_array.f90, then inspect the compiler path handling real :: a(5) and a = 1. Done means the command either rejects this unsupported array initialization with an error or produces the expected initialized output instead of silently generating an executable that prints zeros.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, fortran
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.