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

Distinguishing a statement function from an array #34

Open
uNouss opened this issue Nov 13, 2023 · 0 comments
Open

Distinguishing a statement function from an array #34

uNouss opened this issue Nov 13, 2023 · 0 comments

Comments

@uNouss
Copy link
Collaborator

uNouss commented Nov 13, 2023

Situation1

      PROGRAM demo
#include "decl.inc"
      DO 10 I=1,10
      TAB(I) = I*I
 10   CONTINUE
      PRINT*, TAB
      END                                
      INTEGER TAB(10)                          

Situation2

      PROGRAM demo
      INTEGER TAB(10)
      DO 10 I=1,10
      TAB(I) = I*I
 10   CONTINUE
      PRINT*, TAB
      END                                

  1. In Situation1, the parser fortran-src-extras see TAB(I) as a statement function which is wrong
  2. In Situation2, the parser fortran-src-extras see TAB(I) as an array which is correct

The reason is that in the first case the declaration of the tab variable is in the #include ..., so the parser has no information that it is an array, whereas in the second case it has the information (declaration of the tab variable) that it is an array.

Idea for a solution: Create an intermediate entity (IAST) corresponding to a statement function and postpone the resolution when the symbols are resolved.

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

No branches or pull requests

1 participant