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

remove DoSpec from ExpImpliedDo #224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

remove DoSpec from ExpImpliedDo #224

wants to merge 1 commit into from

Conversation

raehik
Copy link
Collaborator

@raehik raehik commented May 13, 2022

No description provided.

@raehik
Copy link
Collaborator Author

raehik commented May 13, 2022

gfortran has some strange behaviour for implied DO loops:

  • used in a print, the final value of the loop variable is retained
  • used in an assignment, the loop variable is left untouched
program main
    integer i
    integer is(5)
    print *, i                  ! 0
    print *, ( i, i = -1, 2 )
    print *, i                  ! 3
    is = [ (i, i = 2, 6) ]
    print *, is
    print *, i                  ! 3
end

Putting aside the print behaviour, they feel like syntactic sugar. gfortran even tells you if it's the wrong shape for the assigning array, implying it evaluates them to arrays during compilation. Based on this, I feel the assignment inside implied DOs isn't a real assignment, just syntax reuse.

@dorchard
Copy link
Member

The tricky thing is that now we've lost the data flow path due to an assignment...!

@mrd
Copy link
Collaborator

mrd commented May 16, 2022

I wouldn't count on gfortran for sensible/reliable behaviour.

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

Successfully merging this pull request may close these issues.

None yet

3 participants