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

bug with assumed-size #333

Open
ecossevin opened this issue Jun 13, 2024 · 1 comment
Open

bug with assumed-size #333

ecossevin opened this issue Jun 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ecossevin
Copy link

ecossevin commented Jun 13, 2024

sub.F90 :

SUBROUTINE TOTO(KPROMA, POUT1)

IMPLICIT NONE
INTEGER, INTENT (IN)::KPROMA
REAL, INTENT (OUT)::POUT1 (KPROMA,*)

END SUBROUTINE TOTO

test.py :

from loki import *
import sys


file_name = "sub.F90"
source=Sourcefile.from_file(file_name)
src_name = "TOTO"
routine=source[src_name]
print(fgen(routine))

test.py (fgen) returns wrong dimensions for POUT1:
REAL, INTENT(OUT) :: POUT1((KPROMA,):)

Thanks in advance for your help.

@reuterbal
Copy link
Collaborator

Thanks, we seem to indeed not have a representation of assumed size dimensions. Here's a pytest reproducing the issue and capturing all relevant cases that seem to be allowed in Fortran:

@pytest.mark.parametrize('frontend', available_frontends())
def test_array_assumed_size(frontend):
    fcode = """
SUBROUTINE TOTO(KPROMA, A, B, C, POUT1)
IMPLICIT NONE
INTEGER, INTENT (IN)    :: KPROMA
INTEGER, INTENT (INOUT) :: A(5, *), B(*), C(0:1, 2:*)
REAL   , INTENT (OUT)   :: POUT1 (KPROMA, *)
	SUBROUTINE PULLDOWN ( A, B, C )
END SUBROUTINE TOTO
    """.strip()
    routine = Subroutine.from_source(fcode, frontend=frontend)

The precise format of representing this needs to be discussed, though.

@reuterbal reuterbal added the bug Something isn't working label Jul 3, 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

No branches or pull requests

2 participants