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

Complex expression in array declaration #2720

Open
hbrunie opened this issue Sep 25, 2024 · 0 comments
Open

Complex expression in array declaration #2720

hbrunie opened this issue Sep 25, 2024 · 0 comments
Labels
bug PSyIR Core PSyIR functionality

Comments

@hbrunie
Copy link
Collaborator

hbrunie commented Sep 25, 2024

This unit test shows the bug:

def test_psyclone_boundary_expr_wrong():
    code = """subroutine foo(a,b,c,n)
  integer :: n
  real*8, dimension(1:) :: a
  real*8, dimension(1:n) :: b
  real*8, dimension(n:) :: c
  real*8, dimension(:) :: d


end subroutine foo\n"""
    reader = FortranReader()
    psyir_tree = reader.psyir_from_source(code)
    writer = FortranWriter()
    output = writer(psyir_tree)
    assert code == output

With this one gfortran -c test.f90 returns no error.

But with the one generated by psyclone, there is an error.

    subroutine foo(a, b, c, n)
      integer :: n
  -   real*8, dimension() :: a
  +   real*8, dimension(1:) :: a
  ?                     ++
  -   real*8, dimension(n) :: b
  +   real*8, dimension(1:n) :: b
  ?                     ++
      real*8, dimension(n:) :: c
      real*8, dimension(:) :: d
    
    
    end subroutine foo

Here the error

 >> gfortran test.f90 -c
test.f90:3:21:

    3 |   real*8, dimension() :: a
      |                     1
Error: Expected expression in array specification at (1)
@hbrunie hbrunie added bug PSyIR Core PSyIR functionality labels Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug PSyIR Core PSyIR functionality
Projects
None yet
Development

No branches or pull requests

1 participant