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

"Array access to function call" directive crashes on subprograms #595

Open
FrostyMike opened this issue Jan 8, 2021 · 3 comments
Open

Comments

@FrostyMike
Copy link
Contributor

FrostyMike commented Jan 8, 2021

!
! This file is released under terms of BSD license
! See LICENSE file for more information
!
! Simple program to test the kcache directive
!

PROGRAM claw_test

  INTEGER :: istart = 0
  INTEGER :: iend = 10
  INTEGER :: jstart = 0
  INTEGER :: jend = 20
  CALL call_test(istart,iend,jstart,jend)
contains

PURE FUNCTION f(i,j)
  INTEGER, INTENT(IN) :: i,j
  REAL :: f
  f = 1.0 * i * j
END FUNCTION

SUBROUTINE call_test(istart,iend,jstart,jend)
  INTEGER, INTENT(IN) :: istart, iend, jstart, jend
  INTEGER :: i,j
  REAL, DIMENSION(istart:iend,istart:iend) :: array6, array7

  DO i = istart, iend
    DO j = jstart, jend
      array6(i,j) = 1.0 * i * j
    END DO
  END DO

  DO i = istart, iend
    DO j = jstart, jend
      !$claw call array6=f(i,j)
      array7(i,j) = array6(i,j) * 2.0
    END DO
  END DO
END SUBROUTINE call_test

END PROGRAM claw_test
@claw-project claw-project deleted a comment from github-actions bot Jan 8, 2021
@FrostyMike FrostyMike changed the title Array access to function call crashes on subprograms "Array access to function call" directive crashes on subprograms Jan 8, 2021
@clementval
Copy link
Collaborator

Function and subroutine should be in a module. At least the current code is checking for that. Function definition should be retrieved differently if there are not nested in a module.

@FrostyMike
Copy link
Contributor Author

Function and subroutine should be in a module.

Your original test case does not have function & subroutine in the module. Considering your comment, do I understand correctly that this was not intentional?

@clementval
Copy link
Collaborator

At least the current code is not expecting the function and the subroutine to be contained in the program subroutine. I guess a check should be added for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants